Update README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
| 1 |
-
---
|
| 2 |
-
license: cc-by-nc-4.0
|
| 3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-nc-4.0
|
| 3 |
+
library_name: diffusers
|
| 4 |
+
base_model: runwayml/stable-diffusion-v1-5
|
| 5 |
+
tags:
|
| 6 |
+
- lora
|
| 7 |
+
- text-to-image
|
| 8 |
+
---
|
| 9 |
+
# ⚡ FlashDiffusion: FlashSD ⚡
|
| 10 |
+
|
| 11 |
+
<p align="center">
|
| 12 |
+
<img style="width:400px;" src="images/hf_grid.png">
|
| 13 |
+
</p>
|
| 14 |
+
|
| 15 |
+
Flash Diffusion is a diffusion distillation method proposed in [ADD ARXIV]() *by Clément Chadebec, Onur Tasar and Benjamin Aubin.*
|
| 16 |
+
This model is a 26.4M LoRA distilled version of SD1.5 model. The main purpose of this model is to reproduce the main results of the paper.
|
| 17 |
+
|
| 18 |
+
# How to use?
|
| 19 |
+
|
| 20 |
+
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**.
|
| 21 |
+
|
| 22 |
+
```python
|
| 23 |
+
from diffusers import StableDiffusionPipeline, LCMScheduler
|
| 24 |
+
|
| 25 |
+
adapter_id = "jasperai/flash-sd"
|
| 26 |
+
|
| 27 |
+
pipe = StableDiffusionPipeline.from_pretrained(
|
| 28 |
+
"runwayml/stable-diffusion-v1-5",
|
| 29 |
+
use_safetensors=True,
|
| 30 |
+
)
|
| 31 |
+
|
| 32 |
+
pipe.scheduler = LCMScheduler.from_pretrained(
|
| 33 |
+
"runwayml/stable-diffusion-v1-5",
|
| 34 |
+
subfolder="scheduler",
|
| 35 |
+
timestep_spacing="trailing",
|
| 36 |
+
)
|
| 37 |
+
pipe.to("cuda")
|
| 38 |
+
|
| 39 |
+
# Fuse and load LoRA weights
|
| 40 |
+
pipe.load_lora_weights(adapter_id)
|
| 41 |
+
pipe.fuse_lora()
|
| 42 |
+
|
| 43 |
+
prompt = "A raccoon reading a book in a lush forest."
|
| 44 |
+
|
| 45 |
+
image = pipe(prompt, num_inference_steps=4, guidance_scale=0).images[0]
|
| 46 |
+
```
|
| 47 |
+
<p align="center">
|
| 48 |
+
<img style="width:400px;" src="images/raccoon.png">
|
| 49 |
+
</p>
|