Upload 9 files
Browse files- .gitattributes +7 -0
- README.md +84 -4
- assets/edit_results.png +3 -0
- assets/generalization_results.png +3 -0
- assets/illustration.png +0 -0
- assets/more_example_depth.png +3 -0
- assets/more_example_hed.png +3 -0
- assets/more_example_seg.png +3 -0
- assets/multi_task_results.png +3 -0
- assets/teaser_img.png +3 -0
.gitattributes
CHANGED
|
@@ -32,3 +32,10 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 32 |
*.zip filter=lfs diff=lfs merge=lfs -text
|
| 33 |
*.zst filter=lfs diff=lfs merge=lfs -text
|
| 34 |
*tfevents* filter=lfs diff=lfs merge=lfs -text
|
| 35 |
+
assets/edit_results.png filter=lfs diff=lfs merge=lfs -text
|
| 36 |
+
assets/generalization_results.png filter=lfs diff=lfs merge=lfs -text
|
| 37 |
+
assets/more_example_depth.png filter=lfs diff=lfs merge=lfs -text
|
| 38 |
+
assets/more_example_hed.png filter=lfs diff=lfs merge=lfs -text
|
| 39 |
+
assets/more_example_seg.png filter=lfs diff=lfs merge=lfs -text
|
| 40 |
+
assets/multi_task_results.png filter=lfs diff=lfs merge=lfs -text
|
| 41 |
+
assets/teaser_img.png filter=lfs diff=lfs merge=lfs -text
|
README.md
CHANGED
|
@@ -1,9 +1,89 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
|
| 4 |
|
| 5 |
**In-Context Learning Unlocked for Diffusion Models**<br>
|
| 6 |
Zhendong Wang, Yifan Jiang, Yadong Lu, Yelong Shen, Pengcheng He, Weizhu Chen, Zhangyang Wang and Mingyuan Zhou <br>
|
| 7 |
|
| 8 |
-
|
| 9 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
## Prompt-Diffusion: In-Context Learning Unlocked for Diffusion Models
|
| 2 |
+
### [Project Page](https://zhendong-wang.github.io/prompt-diffusion.github.io/) | [Paper](https://arxiv.org/abs/2305.01115)
|
| 3 |
+

|
| 4 |
|
| 5 |
**In-Context Learning Unlocked for Diffusion Models**<br>
|
| 6 |
Zhendong Wang, Yifan Jiang, Yadong Lu, Yelong Shen, Pengcheng He, Weizhu Chen, Zhangyang Wang and Mingyuan Zhou <br>
|
| 7 |
|
| 8 |
+
[//]: # (https://arxiv.org/abs/2206.02262 <br>)
|
| 9 |
|
| 10 |
+
Abstract: *We present Prompt Diffusion, a framework for enabling in-context learning in diffusion-based generative models.
|
| 11 |
+
Given a pair of task-specific example images, such as depth from/to image and scribble from/to image, and a text guidance,
|
| 12 |
+
our model automatically understands the underlying task and performs the same task on a new query image following the text guidance.
|
| 13 |
+
To achieve this, we propose a vision-language prompt that can model a wide range of vision-language tasks and a diffusion model that takes it as input.
|
| 14 |
+
The diffusion model is trained jointly on six different tasks using these prompts.
|
| 15 |
+
The resulting Prompt Diffusion model becomes the first diffusion-based vision-language foundation model capable of in-context learning.
|
| 16 |
+
It demonstrates high-quality in-context generation for the trained tasks and effectively generalizes to new, unseen vision tasks using their respective prompts.
|
| 17 |
+
Our model also shows compelling text-guided image editing results. Our framework aims to facilitate research into in-context learning for computer vision, with code publicly available here.*
|
| 18 |
+
|
| 19 |
+

|
| 20 |
+
|
| 21 |
+
## ToDos
|
| 22 |
+
- [x] Release pretrained models
|
| 23 |
+
- [x] Release play-around codes
|
| 24 |
+
|
| 25 |
+
|
| 26 |
+
## Results
|
| 27 |
+
### Multi-Task Learning
|
| 28 |
+
|
| 29 |
+

|
| 30 |
+
|
| 31 |
+
### Generalization to New Tasks
|
| 32 |
+
|
| 33 |
+

|
| 34 |
+
|
| 35 |
+
### Image Editing Ability
|
| 36 |
+
|
| 37 |
+

|
| 38 |
+
|
| 39 |
+
## Train Prompt Diffusion
|
| 40 |
+
|
| 41 |
+
### Prepare Dataset
|
| 42 |
+
|
| 43 |
+
We use the public dataset proposed by [InstructPix2Pix](https://github.com/timothybrooks/instruct-pix2pix) as our base dataset,
|
| 44 |
+
which consists of around 310k image-caption pairs. Furthermore, we apply the [ControlNet](https://github.com/lllyasviel/ControlNet) annotators
|
| 45 |
+
to collect image conditions such as HED/Depth/Segmentation maps of images. The code for collecting image conditions is provided in `annotate_data.py`.
|
| 46 |
+
|
| 47 |
+
### Training
|
| 48 |
+
|
| 49 |
+
Training a Prompt Diffusion is as easy as follows,
|
| 50 |
+
|
| 51 |
+
```.bash
|
| 52 |
+
python tool_add_control.py 'path to your stable diffusion checkpoint, e.g., /.../v1-5-pruned-emaonly.ckpt' ./models/control_sd15_ini.ckpt
|
| 53 |
+
|
| 54 |
+
python train.py --name 'experiment name' --gpus=8 --num_nodes=1 \
|
| 55 |
+
--logdir 'your logdir path' \
|
| 56 |
+
--data_config './models/dataset.yaml' --base './models/cldm_v15.yaml' \
|
| 57 |
+
--sd_locked
|
| 58 |
+
```
|
| 59 |
+
|
| 60 |
+
We also provide the job script in `scripts/train_v1-5.sh` for an easy run.
|
| 61 |
+
|
| 62 |
+
## Run Prompt Diffusion from our checkpoints
|
| 63 |
+
|
| 64 |
+
We will update the code for playing Prompt Diffusion and the model checkpoints soon.
|
| 65 |
+
|
| 66 |
+
## More Examples
|
| 67 |
+
|
| 68 |
+

|
| 69 |
+

|
| 70 |
+

|
| 71 |
+
|
| 72 |
+
|
| 73 |
+
## Citation
|
| 74 |
+
|
| 75 |
+
|
| 76 |
+
```
|
| 77 |
+
@article{wang2023promptdiffusion,
|
| 78 |
+
title = {In-Context Learning Unlocked for Diffusion Models},
|
| 79 |
+
author = {Wang, Zhendong and Jiang, Yifan and Lu, Yadong and Shen, Yelong and He, Pengcheng and Chen, Weizhu and Wang, Zhangyang and Zhou, Mingyuan},
|
| 80 |
+
journal = {arXiv preprint arXiv:2305.01115},
|
| 81 |
+
year = {2023},
|
| 82 |
+
url = {https://arxiv.org/abs/2305.01115}
|
| 83 |
+
}
|
| 84 |
+
```
|
| 85 |
+
|
| 86 |
+
## Acknowledgements
|
| 87 |
+
We thank [Brooks et al.](https://github.com/timothybrooks/instruct-pix2pix) for sharing the dataset for finetuning Stable Diffusion.
|
| 88 |
+
We also thank [Lvmin Zhang and Maneesh Agrawala
|
| 89 |
+
](https://github.com/lllyasviel/ControlNet) for providing the awesome code base ControlNet.
|
assets/edit_results.png
ADDED
|
Git LFS Details
|
assets/generalization_results.png
ADDED
|
Git LFS Details
|
assets/illustration.png
ADDED
|
assets/more_example_depth.png
ADDED
|
Git LFS Details
|
assets/more_example_hed.png
ADDED
|
Git LFS Details
|
assets/more_example_seg.png
ADDED
|
Git LFS Details
|
assets/multi_task_results.png
ADDED
|
Git LFS Details
|
assets/teaser_img.png
ADDED
|
Git LFS Details
|