clementchadebec
commited on
Update README.md
Browse files
README.md
CHANGED
@@ -15,26 +15,52 @@ widget:
|
|
15 |
base_model: stabilityai/stable-diffusion-xl-base-1.0
|
16 |
license: cc-by-nc-nd-4.0
|
17 |
---
|
18 |
-
#
|
19 |
|
20 |
-
<Gallery />
|
21 |
|
|
|
|
|
22 |
|
23 |
-
## Trigger words
|
24 |
|
25 |
-
|
|
|
|
|
26 |
|
27 |
-
|
28 |
|
29 |
-
|
30 |
|
31 |
-
|
|
|
32 |
|
33 |
-
|
34 |
|
|
|
|
|
|
|
|
|
35 |
|
36 |
-
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
-
|
|
|
|
|
39 |
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
15 |
base_model: stabilityai/stable-diffusion-xl-base-1.0
|
16 |
license: cc-by-nc-nd-4.0
|
17 |
---
|
18 |
+
# ⚡ FlashDiffusion: FlashSD ⚡
|
19 |
|
|
|
20 |
|
21 |
+
Flash Diffusion is a diffusion distillation method proposed in [ADD ARXIV]() *by Clément Chadebec, Onur Tasar and Benjamin Aubin.*
|
22 |
+
This model is a **26.4M** LoRA distilled version of SD1.5 model that is able to generate images in **2-4 steps**. The main purpose of this model is to reproduce the main results of the paper.
|
23 |
|
|
|
24 |
|
25 |
+
<p align="center">
|
26 |
+
<img style="width:700px;" src="images/hf_grid.png">
|
27 |
+
</p>
|
28 |
|
29 |
+
# How to use?
|
30 |
|
31 |
+
The model can be used using the `StableDiffusionPipeline` from `diffusers` library directly. It can allow reducing the number of required sampling steps to **2-4 steps**.
|
32 |
|
33 |
+
```python
|
34 |
+
from diffusers import DiffusionPipeline, LCMScheduler
|
35 |
|
36 |
+
adapter_id = "jasperai/flash-sd"
|
37 |
|
38 |
+
pipe = DiffusionPipeline.from_pretrained(
|
39 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
40 |
+
use_safetensors=True,
|
41 |
+
)
|
42 |
|
43 |
+
pipe.scheduler = LCMScheduler.from_pretrained(
|
44 |
+
"stabilityai/stable-diffusion-xl-base-1.0",
|
45 |
+
subfolder="scheduler",
|
46 |
+
timestep_spacing="trailing",
|
47 |
+
)
|
48 |
+
pipe.to("cuda")
|
49 |
|
50 |
+
# Fuse and load LoRA weights
|
51 |
+
pipe.load_lora_weights(adapter_id)
|
52 |
+
pipe.fuse_lora()
|
53 |
|
54 |
+
prompt = "A raccoon reading a book in a lush forest."
|
55 |
+
|
56 |
+
image = pipe(prompt, num_inference_steps=4, guidance_scale=0).images[0]
|
57 |
+
```
|
58 |
+
<p align="center">
|
59 |
+
<img style="width:400px;" src="images/raccoon.png">
|
60 |
+
</p>
|
61 |
+
|
62 |
+
# Training Details
|
63 |
+
|
64 |
+
|
65 |
+
## License
|
66 |
+
This model is released under the the Creative Commons BY-NC license.
|