rockeycoss
commited on
Commit
•
769c246
1
Parent(s):
d85e1da
Update README.md
Browse files
README.md
CHANGED
@@ -1,78 +1,91 @@
|
|
1 |
-
---
|
2 |
-
license: apache-2.0
|
3 |
-
datasets:
|
4 |
-
- yuvalkirstain/pickapic_v1
|
5 |
-
language:
|
6 |
-
- en
|
7 |
-
pipeline_tag: text-to-image
|
8 |
-
---
|
9 |
-
#
|
10 |
-
|
11 |
-
<a href="https://arxiv.org/abs/2406.04314"><img src="https://img.shields.io/badge/Paper-arXiv-red?style=for-the-badge" height=22.5></a>
|
12 |
-
<a href="https://github.com/RockeyCoss/SPO"><img src="https://img.shields.io/badge/Gihub-Code-succees?style=for-the-badge&logo=GitHub" height=22.5></a>
|
13 |
-
<a href="https://rockeycoss.github.io/spo.github.io/"><img src="https://img.shields.io/badge/Project-Page-blue?style=for-the-badge" height=22.5></a>
|
14 |
-
|
15 |
-
<table>
|
16 |
-
<tr>
|
17 |
-
<td><img src="assets/1.png" alt="teaser example 0" width="200"/></td>
|
18 |
-
<td><img src="assets/2.png" alt="teaser example 1" width="200"/></td>
|
19 |
-
<td><img src="assets/3.png" alt="teaser example 2" width="200"/></td>
|
20 |
-
<td><img src="assets/4.png" alt="teaser example 3" width="200"/></td>
|
21 |
-
</tr>
|
22 |
-
</table>
|
23 |
-
|
24 |
-
## Abstract
|
25 |
-
<p>
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
</p>
|
33 |
-
<p>
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
This
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
|
74 |
-
|
75 |
-
|
76 |
-
|
77 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
78 |
```
|
|
|
1 |
+
---
|
2 |
+
license: apache-2.0
|
3 |
+
datasets:
|
4 |
+
- yuvalkirstain/pickapic_v1
|
5 |
+
language:
|
6 |
+
- en
|
7 |
+
pipeline_tag: text-to-image
|
8 |
+
---
|
9 |
+
# Aesthetic Post-Training Diffusion Models from Generic Preferences with Step-by-step Preference
|
10 |
+
|
11 |
+
<a href="https://arxiv.org/abs/2406.04314"><img src="https://img.shields.io/badge/Paper-arXiv-red?style=for-the-badge" height=22.5></a>
|
12 |
+
<a href="https://github.com/RockeyCoss/SPO"><img src="https://img.shields.io/badge/Gihub-Code-succees?style=for-the-badge&logo=GitHub" height=22.5></a>
|
13 |
+
<a href="https://rockeycoss.github.io/spo.github.io/"><img src="https://img.shields.io/badge/Project-Page-blue?style=for-the-badge" height=22.5></a>
|
14 |
+
|
15 |
+
<table>
|
16 |
+
<tr>
|
17 |
+
<td><img src="assets/1.png" alt="teaser example 0" width="200"/></td>
|
18 |
+
<td><img src="assets/2.png" alt="teaser example 1" width="200"/></td>
|
19 |
+
<td><img src="assets/3.png" alt="teaser example 2" width="200"/></td>
|
20 |
+
<td><img src="assets/4.png" alt="teaser example 3" width="200"/></td>
|
21 |
+
</tr>
|
22 |
+
</table>
|
23 |
+
|
24 |
+
## Abstract
|
25 |
+
<p>
|
26 |
+
Generating visually appealing images is fundamental to modern text-to-image generation models.
|
27 |
+
A potential solution to better aesthetics is direct preference optimization (DPO),
|
28 |
+
which has been applied to diffusion models to improve general image quality including prompt alignment and aesthetics.
|
29 |
+
Popular DPO methods propagate preference labels from clean image pairs to all the intermediate steps along the two generation trajectories.
|
30 |
+
However, preference labels provided in existing datasets are blended with layout and aesthetic opinions, which would disagree with aesthetic preference.
|
31 |
+
Even if aesthetic labels were provided (at substantial cost), it would be hard for the two-trajectory methods to capture nuanced visual differences at different steps.
|
32 |
+
</p>
|
33 |
+
<p>
|
34 |
+
To improve aesthetics economically, this paper uses existing generic preference data and introduces step-by-step preference optimization
|
35 |
+
(SPO) that discards the propagation strategy and allows fine-grained image details to be assessed. Specifically,
|
36 |
+
at each denoising step, we 1) sample a pool of candidates by denoising from a shared noise latent,
|
37 |
+
2) use a step-aware preference model to find a suitable win-lose pair to supervise the diffusion model, and
|
38 |
+
3) randomly select one from the pool to initialize the next denoising step.
|
39 |
+
This strategy ensures that diffusion models focus on the subtle, fine-grained visual differences
|
40 |
+
instead of layout aspect. We find that aesthetic can be significantly enhanced by accumulating these
|
41 |
+
improved minor differences.
|
42 |
+
</p>
|
43 |
+
<p>
|
44 |
+
When fine-tuning Stable Diffusion v1.5 and SDXL, SPO yields significant
|
45 |
+
improvements in aesthetics compared with existing DPO methods while not sacrificing image-text alignment
|
46 |
+
compared with vanilla models. Moreover, SPO converges much faster than DPO methods due to the step-by-step
|
47 |
+
alignment of fine-grained visual details.
|
48 |
+
</p>
|
49 |
+
|
50 |
+
## Model Description
|
51 |
+
|
52 |
+
This model is fine-tuned from [runwayml/stable-diffusion-v1-5](https://huggingface.co/runwayml/stable-diffusion-v1-5). It has been trained on 4,000 prompts for 10 epochs. This checkpoint is a LoRA checkpoint. We also provide a LoRA checkpoint compatible with [stable-diffusion-webui](https://github.com/AUTOMATIC1111/stable-diffusion-webui), which can be accessed [here](https://civitai.com/models/526379/spo-sd-v1-54k-p10eplorawebui)
|
53 |
+
|
54 |
+
If you want to access the merged checkpoint that combines the LoRA checkpoint with the base model [runwayml/stable-diffusion-v1-5](https://huggingface.co/runwayml/stable-diffusion-v1-5), please visit [SPO-SD-v1-5_4k-p_10ep](https://huggingface.co/SPO-Diffusion-Models/SPO-SD-v1-5_4k-p_10ep).
|
55 |
+
|
56 |
+
|
57 |
+
|
58 |
+
## A quick example
|
59 |
+
```python
|
60 |
+
from diffusers import StableDiffusionPipeline
|
61 |
+
import torch
|
62 |
+
|
63 |
+
# load pipeline
|
64 |
+
inference_dtype = torch.float16
|
65 |
+
pipe = StableDiffusionPipeline.from_pretrained(
|
66 |
+
"runwayml/stable-diffusion-v1-5",
|
67 |
+
torch_dtype=inference_dtype,
|
68 |
+
)
|
69 |
+
pipe.load_lora_weights("SPO-Diffusion-Models/SPO-SD-v1-5_4k-p_10ep_LoRA")
|
70 |
+
pipe.to('cuda')
|
71 |
+
|
72 |
+
generator=torch.Generator(device='cuda').manual_seed(42)
|
73 |
+
image = pipe(
|
74 |
+
prompt='an image of a beautiful lake',
|
75 |
+
generator=generator,
|
76 |
+
guidance_scale=7.5,
|
77 |
+
output_type='pil',
|
78 |
+
).images[0]
|
79 |
+
image.save('lake.png')
|
80 |
+
```
|
81 |
+
|
82 |
+
## Citation
|
83 |
+
If you find our work or codebase useful, please consider giving us a star and citing our work.
|
84 |
+
```
|
85 |
+
@article{liang2024step,
|
86 |
+
title={Aesthetic Post-Training Diffusion Models from Generic Preferences with Step-by-step Preference Optimization},
|
87 |
+
author={Liang, Zhanhao and Yuan, Yuhui and Gu, Shuyang and Chen, Bohan and Hang, Tiankai and Cheng, Mingxi and Li, Ji and Zheng, Liang},
|
88 |
+
journal={arXiv preprint arXiv:2406.04314},
|
89 |
+
year={2024}
|
90 |
+
}
|
91 |
```
|