Skip to content

Commit 40c16ed

Browse files
authored
Added Community pipeline for comparing Stable Diffusion v1.1-4 checkpoints (#1584)
* Added Community pipeline for comparing Stable Diffusion v1.1-4 Signed-off-by: Suvaditya Mukherjee <[email protected]> * Made changes to provide support for current iteration of from_pretrained and added example Signed-off-by: Suvaditya Mukherjee <[email protected]> * updated a small spelling error Signed-off-by: Suvaditya Mukherjee <[email protected]> * added pipeline entry to table Signed-off-by: Suvaditya Mukherjee <[email protected]> Signed-off-by: Suvaditya Mukherjee <[email protected]>
1 parent 69de9b2 commit 40c16ed

File tree

2 files changed

+448
-1
lines changed

2 files changed

+448
-1
lines changed

examples/community/README.md

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ If a community doesn't work as expected, please open an issue and ping the autho
2323
| Text Based Inpainting Stable Diffusion | Stable Diffusion Inpainting Pipeline that enables passing a text prompt to generate the mask for inpainting| [Text Based Inpainting Stable Diffusion](#image-to-image-inpainting-stable-diffusion) | - | [Dhruv Karan](https://github.com/unography) |
2424
| Bit Diffusion | Diffusion on discrete data | [Bit Diffusion](#bit-diffusion) | - |[Stuti R.](https://github.com/kingstut) |
2525
| K-Diffusion Stable Diffusion | Run Stable Diffusion with any of [K-Diffusion's samplers](https://github.com/crowsonkb/k-diffusion/blob/master/k_diffusion/sampling.py) | [Stable Diffusion with K Diffusion](#stable-diffusion-with-k-diffusion) | - | [Patrick von Platen](https://github.com/patrickvonplaten/) |
26-
| Checkpoint Merger Pipeline | Diffusion Pipeline that enables merging of saved model checkpoints | [Checkpoint Merger Pipeline](#checkpoint-merger-pipeline) | - | [Naga Sai Abhinay Devarinti](https://github.com/Abhinay1997/) |
26+
| Checkpoint Merger Pipeline | Diffusion Pipeline that enables merging of saved model checkpoints | [Checkpoint Merger Pipeline](#checkpoint-merger-pipeline) | - | [Naga Sai Abhinay Devarinti](https://github.com/Abhinay1997/) |
27+
Stable Diffusion v1.1-1.4 Comparison | Run all 4 model checkpoints for Stable Diffusion and compare their results together | [Stable Diffusion Comparison](#stable-diffusion-comparisons) | - | [Suvaditya Mukherjee](https://github.com/suvadityamuk) |
2728

2829

2930

@@ -774,3 +775,44 @@ Some examples along with the merge details:
774775
3. "CompVis/stable-diffusion-v1-4" + "hakurei/waifu-diffusion" + "prompthero/openjourney"; Add Difference interpolation; alpha = 0.5
775776

776777
![Stable plus Waifu plus openjourney add_diff 0.5](https://huggingface.co/datasets/NagaSaiAbhinay/CheckpointMergerSamples/resolve/main/stable_waifu_openjourney_add_diff_0.5.png)
778+
779+
780+
### Stable Diffusion Comparisons
781+
782+
This Community Pipeline enables the comparison between the 4 checkpoints that exist for Stable Diffusion. They can be found through the following links:
783+
1. [Stable Diffusion v1.1](https://huggingface.co/CompVis/stable-diffusion-v1-1)
784+
2. [Stable Diffusion v1.2](https://huggingface.co/CompVis/stable-diffusion-v1-2)
785+
3. [Stable Diffusion v1.3](https://huggingface.co/CompVis/stable-diffusion-v1-3)
786+
4. [Stable Diffusion v1.4](https://huggingface.co/CompVis/stable-diffusion-v1-4)
787+
788+
```python
789+
from diffusers import DiffusionPipeline
790+
import matplotlib.pyplot as plt
791+
792+
pipe = DiffusionPipeline.from_pretrained('CompVis/stable-diffusion-v1-4', custom_pipeline='suvadityamuk/StableDiffusionComparison')
793+
pipe.enable_attention_slicing()
794+
pipe = pipe.to('cuda')
795+
prompt = "an astronaut riding a horse on mars"
796+
output = pipe(prompt)
797+
798+
plt.subplots(2,2,1)
799+
plt.imshow(output.images[0])
800+
plt.title('Stable Diffusion v1.1')
801+
plt.axis('off')
802+
plt.subplots(2,2,2)
803+
plt.imshow(output.images[1])
804+
plt.title('Stable Diffusion v1.2')
805+
plt.axis('off')
806+
plt.subplots(2,2,3)
807+
plt.imshow(output.images[2])
808+
plt.title('Stable Diffusion v1.3')
809+
plt.axis('off')
810+
plt.subplots(2,2,4)
811+
plt.imshow(output.images[3])
812+
plt.title('Stable Diffusion v1.4')
813+
plt.axis('off')
814+
815+
plt.show()
816+
```python
817+
818+
As a result, you can look at a grid of all 4 generated images being shown together, that captures a difference the advancement of the training between the 4 checkpoints.

0 commit comments

Comments
 (0)