|
--- |
|
license: cc-by-nc-4.0 |
|
library_name: diffusers |
|
base_model: runwayml/stable-diffusion-v1-5 |
|
tags: |
|
- lora |
|
- text-to-image |
|
--- |
|
# ⚡ FlashDiffusion: FlashSD ⚡ |
|
|
|
<p align="center"> |
|
<img style="width:400px;" src="images/hf_grid.png"> |
|
</p> |
|
|
|
Flash Diffusion is a diffusion distillation method proposed in [ADD ARXIV]() *by Clément Chadebec, Onur Tasar and Benjamin Aubin.* |
|
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. |
|
|
|
# How to use? |
|
|
|
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**. |
|
|
|
```python |
|
from diffusers import StableDiffusionPipeline, LCMScheduler |
|
|
|
adapter_id = "jasperai/flash-sd" |
|
|
|
pipe = StableDiffusionPipeline.from_pretrained( |
|
"runwayml/stable-diffusion-v1-5", |
|
use_safetensors=True, |
|
) |
|
|
|
pipe.scheduler = LCMScheduler.from_pretrained( |
|
"runwayml/stable-diffusion-v1-5", |
|
subfolder="scheduler", |
|
timestep_spacing="trailing", |
|
) |
|
pipe.to("cuda") |
|
|
|
# Fuse and load LoRA weights |
|
pipe.load_lora_weights(adapter_id) |
|
pipe.fuse_lora() |
|
|
|
prompt = "A raccoon reading a book in a lush forest." |
|
|
|
image = pipe(prompt, num_inference_steps=4, guidance_scale=0).images[0] |
|
``` |
|
<p align="center"> |
|
<img style="width:400px;" src="images/raccoon.png"> |
|
</p> |
|
|