Text-to-Image
Diffusers
Safetensors
lora
clementchadebec commited on
Commit
2139044
1 Parent(s): 5e5258e

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +70 -3
README.md CHANGED
@@ -1,3 +1,70 @@
1
- ---
2
- license: cc-by-nc-4.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ library_name: diffusers
4
+ base_model: PixArt-alpha/PixArt-XL-2-1024-MS
5
+ tags:
6
+ - lora
7
+ - text-to-image
8
+ inference: False
9
+ ---
10
+ # ⚡ FlashDiffusion: FlashPixart ⚡
11
+
12
+
13
+ Flash Diffusion is a diffusion distillation method proposed in [ADD ARXIV]() *by Clément Chadebec, Onur Tasar and Benjamin Aubin.*
14
+ This model is a **26.4M** LoRA distilled version of Pixart-α model that is able to generate 1024x1024 images in **4 steps**.
15
+
16
+
17
+ <p align="center">
18
+ <img style="width:700px;" src="images/hf_grid.png">
19
+ </p>
20
+
21
+ # How to use?
22
+
23
+ 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**.
24
+
25
+ ```python
26
+ import torch
27
+ from diffusers import PixArtAlphaPipeline, Transformer2DModel, LCMScheduler
28
+ from peft import PeftModel
29
+
30
+ # Load LoRA
31
+ transformer = Transformer2DModel.from_pretrained(
32
+ "PixArt-alpha/PixArt-XL-2-1024-MS",
33
+ subfolder="transformer",
34
+ torch_dtype=torch.float16
35
+ )
36
+ transformer = PeftModel.from_pretrained(
37
+ transformer,
38
+ "jasperai/flash-pixart"
39
+ )
40
+
41
+ # Pipeline
42
+ pipe = PixArtAlphaPipeline.from_pretrained(
43
+ "PixArt-alpha/PixArt-XL-2-1024-MS",
44
+ transformer=transformer,
45
+ torch_dtype=torch.float16
46
+ )
47
+
48
+ # Scheduler
49
+ pipe.scheduler = LCMScheduler.from_pretrained(
50
+ "PixArt-alpha/PixArt-XL-2-1024-MS",
51
+ subfolder="scheduler",
52
+ timestep_spacing="trailing",
53
+ )
54
+
55
+ pipe.to("cuda")
56
+
57
+ prompt = "A raccoon reading a book in a lush forest."
58
+
59
+ image = pipe(prompt, num_inference_steps=4, guidance_scale=0).images[0]
60
+ ```
61
+ <p align="center">
62
+ <img style="width:400px;" src="images/raccoon.png">
63
+ </p>
64
+
65
+ # Training Details
66
+ The model was trained for 40k iterations on 4 H100 GPUs. Please refer to the [paper]() for further parameters details.
67
+
68
+
69
+ ## License
70
+ This model is released under the the Creative Commons BY-NC license.