File size: 2,337 Bytes
f686968
 
6b59212
 
043318a
 
f686968
043318a
f686968
 
 
 
 
 
ef68ca4
 
 
 
f686968
043318a
ef68ca4
 
043318a
ef68ca4
 
 
043318a
ef68ca4
 
 
 
043318a
ef68ca4
 
043318a
 
ef68ca4
 
 
 
 
043318a
abf7ea2
043318a
 
 
ef68ca4
043318a
 
ef68ca4
043318a
ef68ca4
 
2c1f249
043318a
ef68ca4
 
cec4b0c
ef68ca4
6c1e673
 
 
 
043318a
 
 
 
 
 
 
6c1e673
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
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
---
license: apache-2.0
library_name: diffusers
pipeline_tag: text-to-image
base_model:
- stabilityai/stable-diffusion-3.5-medium
---
# Scale-wise Distillation SD3.5 Medium
Scale-wise Distillation (SwD) is a novel framework for accelerating diffusion models (DMs) 
by progressively increasing spatial resolution during the generation process. 
<br>SwD achieves significant speedups (2.5× to 10×) compared to full-resolution models 
while maintaining or even improving image quality.
![3.5 Medium Demo Image](swd.png)

Project page: https://yandex-research.github.io/swd <br>
GitHub: https://github.com/yandex-research/swd <br>
Demo: https://huggingface.co/spaces/dbaranchuk/Scale-wise-Distillation

## Usage
Upgrade to the latest version of the [🧨 diffusers](https://github.com/huggingface/diffusers) and [🧨 peft](https://github.com/huggingface/peft)
```
pip install -U diffusers
pip install -U peft
```

and then you can run
<br>
```py
import torch
from diffusers import StableDiffusion3Pipeline
from peft import PeftModel

pipe = StableDiffusion3Pipeline.from_pretrained("stabilityai/stable-diffusion-3.5-medium",
                                                torch_dtype=torch.float16,
                                                custom_pipeline="quickjkee/swd_pipeline").to("cuda")
lora_path = "yresearch/swd-medium-4-steps"
pipe.transformer = PeftModel.from_pretrained(
    pipe.transformer,
    lora_path,
)

prompt = "Cute winter dragon baby, kawaii, Pixar, ultra detailed, glacial background, extremely realistic."
sigmas = [1.0000, 0.8956, 0.7363, 0.6007, 0.0000]
scales = [64, 80, 96, 128]

image = pipe(
    prompt,
    sigmas=sigmas,
    timesteps=torch.tensor(sigmas[:-1], device="cuda") * 1000,
    scales=scales,
    guidance_scale=1.0,
    height=int(scales[0] * 8),
    width=int(scales[0] * 8),
    max_sequence_length=512,
).images[0]
```
<p align="center">
<img src="medium.jpg" width="512px"/>
</p>

## Citation

```bibtex
@inproceedings{
    starodubcev2026scalewise,
    title={Scale-wise Distillation of Diffusion Models},
    author={Nikita Starodubcev and Ilya Drobyshevskiy and Denis Kuznedelev and Artem Babenko and Dmitry Baranchuk},
    booktitle={The Fourteenth International Conference on Learning Representations},
    year={2026},
    url={https://openreview.net/forum?id=Z06LNjqU1g}
}
```