Create README.md
Browse files
README.md
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
base_model:
|
| 3 |
+
- stabilityai/stable-diffusion-xl-base-1.0
|
| 4 |
+
pipeline_tag: text-to-image
|
| 5 |
+
tags:
|
| 6 |
+
- art
|
| 7 |
+
---
|
| 8 |
+
<h1 align="center">The Superposition of Diffusion Models Using the It么 Density Estimator: <em>Pipeline</em></h1>
|
| 9 |
+
|
| 10 |
+
<p align="center">
|
| 11 |
+
<a href="https://arxiv.org/abs/2412.17762"><img src="https://img.shields.io/badge/Arxiv-2412.17762-red?style=for-the-badge&logo=Arxiv" alt="arXiv"/></a>
|
| 12 |
+
</p>
|
| 13 |
+
|
| 14 |
+
This pipeline shows how to superimpose different text prompts from [Stable Diffusion-XL 1.0](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0) based the paper [The Superposition of Diffusion Models Using the It么 Density Estimator](https://www.arxiv.org/abs/2412.17762). The authors would like to thank Viktor Ohanesian for developing the SD-XL pipeline.
|
| 15 |
+
|
| 16 |
+
<p align="center">
|
| 17 |
+
<img src="https://huggingface.co/superdiff/superdiff-sd-v1-4/resolve/main/superdiff_small.gif" alt="drawing" style="width:500px;">
|
| 18 |
+
</p>
|
| 19 |
+
|
| 20 |
+
## Requirements
|
| 21 |
+
|
| 22 |
+
This pipeline can be run with the following packages & versions:
|
| 23 |
+
- `PyTorch 2.5.1`
|
| 24 |
+
- `Diffusers 0.32.1`
|
| 25 |
+
- `Accelerate 1.2.1`
|
| 26 |
+
- `Transformers 4.47.1`
|
| 27 |
+
|
| 28 |
+
You can install these with:
|
| 29 |
+
|
| 30 |
+
```
|
| 31 |
+
pip install torch
|
| 32 |
+
pip install diffusers accelerate transformers
|
| 33 |
+
```
|
| 34 |
+
|
| 35 |
+
## Example usage
|
| 36 |
+
|
| 37 |
+
```
|
| 38 |
+
from PIL import Image
|
| 39 |
+
from diffusers import DiffusionPipeline
|
| 40 |
+
|
| 41 |
+
pipeline = DiffusionPipeline.from_pretrained("stabilityai/stable-diffusion-xl-base-1.0", custom_pipeline="superdiff/superdiff-sdxl-v1-0")
|
| 42 |
+
output = pipeline("a flamingo", "a candy cane", seed=1, num_inference_steps=200, batch_size=1)
|
| 43 |
+
|
| 44 |
+
image = Image.fromarray(output[0].cpu().numpy())
|
| 45 |
+
image.save("superdiff_output.png")
|
| 46 |
+
```
|
| 47 |
+
|
| 48 |
+
Arguments that can be set by user in `pipeline()`:
|
| 49 |
+
|
| 50 |
+
- `prompt_1` [required]: text prompt describing first concept to superimpose (e.g. "a flamingo")
|
| 51 |
+
- `prompt_2`[required]: text prompt describing second concept to superimpose (e.g. "a candy cane")
|
| 52 |
+
- `seed`[optional: default=None]: seed for random noise generator for reproducibility; for non-deterministic outputs, set to `None`
|
| 53 |
+
- `num_inference_steps`[optional: default=1000]: number of denoising steps (we recommend 1000!)
|
| 54 |
+
- `batch_size` [optional: default=1]: batch size
|
| 55 |
+
- `guidance_scale` [optional: default=7.5]: scale for classifier-free guidance
|
| 56 |
+
- `height`, `width` [optional: default=512]: height and width of generated images
|
| 57 |
+
|
| 58 |
+
|
| 59 |
+
## Citation
|
| 60 |
+
|
| 61 |
+
**BibTeX:**
|
| 62 |
+
|
| 63 |
+
```
|
| 64 |
+
@article{skreta2024superposition,
|
| 65 |
+
title={The Superposition of Diffusion Models Using the It$\backslash$\^{} o Density Estimator},
|
| 66 |
+
author={Skreta, Marta and Atanackovic, Lazar and Bose, Avishek Joey and Tong, Alexander and Neklyudov, Kirill},
|
| 67 |
+
journal={arXiv preprint arXiv:2412.17762},
|
| 68 |
+
year={2024}
|
| 69 |
+
}
|
| 70 |
+
```
|