Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,78 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: apache-2.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: apache-2.0
|
| 3 |
+
library_name: diffusers
|
| 4 |
+
pipeline_tag: text-to-image
|
| 5 |
+
base_model:
|
| 6 |
+
- stabilityai/stable-diffusion-xl-base-1.0
|
| 7 |
+
---
|
| 8 |
+
# Scale-wise Distillation SDXL
|
| 9 |
+
Scale-wise Distillation (SwD) is a novel framework for accelerating diffusion models (DMs)
|
| 10 |
+
by progressively increasing spatial resolution during the generation process.
|
| 11 |
+
<br>SwD achieves significant speedups (2.5× to 10×) compared to full-resolution models
|
| 12 |
+
while maintaining or even improving image quality.
|
| 13 |
+

|
| 14 |
+
|
| 15 |
+
Project page: https://yandex-research.github.io/swd <br>
|
| 16 |
+
GitHub: https://github.com/yandex-research/swd <br>
|
| 17 |
+
Demo: https://huggingface.co/spaces/dbaranchuk/Scale-wise-Distillation
|
| 18 |
+
|
| 19 |
+
## Usage
|
| 20 |
+
Upgrade to the latest version of the [🧨 diffusers](https://github.com/huggingface/diffusers) and [🧨 peft](https://github.com/huggingface/peft)
|
| 21 |
+
```
|
| 22 |
+
pip install -U diffusers
|
| 23 |
+
pip install -U peft
|
| 24 |
+
```
|
| 25 |
+
|
| 26 |
+
and then you can run
|
| 27 |
+
<br>
|
| 28 |
+
```py
|
| 29 |
+
import torch
|
| 30 |
+
from diffusers import DDPMScheduler, StableDiffusionXLPipeline
|
| 31 |
+
from peft import PeftModel
|
| 32 |
+
|
| 33 |
+
pipe = StableDiffusionXLPipeline.from_pretrained(
|
| 34 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 35 |
+
torch_dtype=torch.float16,
|
| 36 |
+
custom_pipeline="quickjkee/swd_pipeline_sdxl",
|
| 37 |
+
).to("cuda")
|
| 38 |
+
|
| 39 |
+
pipe.scheduler = DDPMScheduler.from_pretrained(
|
| 40 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
| 41 |
+
subfolder="scheduler",
|
| 42 |
+
)
|
| 43 |
+
|
| 44 |
+
lora_path = "yresearch/swd-sdxl"
|
| 45 |
+
pipe.unet = PeftModel.from_pretrained(
|
| 46 |
+
pipe.unet,
|
| 47 |
+
lora_path,
|
| 48 |
+
)
|
| 49 |
+
|
| 50 |
+
prompt = "Cute winter dragon baby, kawaii, Pixar, ultra detailed, glacial background, extremely realistic."
|
| 51 |
+
sigmas = [1.0000, 0.8000, 0.6000, 0.4000, 0.0000]
|
| 52 |
+
scales = [64, 80, 96, 128]
|
| 53 |
+
|
| 54 |
+
image = pipe(
|
| 55 |
+
prompt,
|
| 56 |
+
timesteps=torch.tensor(sigmas) * 1000,
|
| 57 |
+
scales=scales,
|
| 58 |
+
height=1024,
|
| 59 |
+
width=1024,
|
| 60 |
+
guidance_scale=1.0,
|
| 61 |
+
).images[0]
|
| 62 |
+
```
|
| 63 |
+
<p align="center">
|
| 64 |
+
<img src="sdxl.png" width="512px"/>
|
| 65 |
+
</p>
|
| 66 |
+
|
| 67 |
+
## Citation
|
| 68 |
+
|
| 69 |
+
```bibtex
|
| 70 |
+
@inproceedings{
|
| 71 |
+
starodubcev2026scalewise,
|
| 72 |
+
title={Scale-wise Distillation of Diffusion Models},
|
| 73 |
+
author={Nikita Starodubcev and Ilya Drobyshevskiy and Denis Kuznedelev and Artem Babenko and Dmitry Baranchuk},
|
| 74 |
+
booktitle={The Fourteenth International Conference on Learning Representations},
|
| 75 |
+
year={2026},
|
| 76 |
+
url={https://openreview.net/forum?id=Z06LNjqU1g}
|
| 77 |
+
}
|
| 78 |
+
```
|