patrickvonplaten commited on
Commit
0fa535e
1 Parent(s): aff2dff

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +64 -2
README.md CHANGED
@@ -1,4 +1,40 @@
1
- ```py
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2
  from diffusers import UNet2DConditionModel, DiffusionPipeline, LCMScheduler
3
 
4
  unet = UNet2DConditionModel.from_pretrained("latent-consistency/lcm-sdxl", torch_dtype=torch.float16, variant="fp16")
@@ -10,4 +46,30 @@ pipe.set_progress_bar_config(disable=None)
10
  prompt = "a red car standing on the side of the street"
11
 
12
  image = pipe(prompt, num_inference_steps=4, guidance_scale=8.0).images[0]
13
- ```
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: diffusers
3
+ base_model: stabilityai/stable-diffusion-xl-base-1.0
4
+ tags:
5
+ - lora
6
+ - text-to-image
7
+ license: openrail++
8
+ inference: false
9
+ ---
10
+
11
+ # Latent Consistency Model (LCM): SDXL
12
+
13
+ Latent Consistency Model (LCM) was proposed in [Latent Consistency Models: Synthesizing High-Resolution Images with Few-Step Inference](https://arxiv.org/abs/2310.04378)
14
+ by *Simian Luo, Yiqin Tan et al.* and [Simian Luo](https://huggingface.co/SimianLuo), [Suraj Patil](https://huggingface.co/valhalla), and [Daniel Gu](https://huggingface.co/dg845)
15
+ succesfully applied the same approach to create LCM for SDXL.
16
+
17
+ This checkpoint is a LCM distilled version of [`stable-diffusion-xl-base-1.0`](https://huggingface.co/stabilityai/stable-diffusion-xl-base-1.0) that allows
18
+ to reduce the number of inference steps to only between **2 - 8 steps**.
19
+
20
+
21
+ ## Usage
22
+
23
+ LCM SDXL is supported in 🤗 Hugging Face Diffusers library from version v0.23.0 onwards. To run the model, first
24
+ install the latest version of the Diffusers library as well as `peft`, `accelerate` and `transformers`.
25
+ audio dataset from the Hugging Face Hub:
26
+
27
+ ```bash
28
+ pip install --upgrade pip
29
+ pip install --upgrade diffusers transformers accelerate peft
30
+ ```
31
+
32
+ ### Text-to-Image
33
+
34
+ The adapter can be loaded with it's base model `stabilityai/stable-diffusion-xl-base-1.0`. Next, the scheduler needs to be changed to [`LCMScheduler`](https://huggingface.co/docs/diffusers/v0.22.3/en/api/schedulers/lcm#diffusers.LCMScheduler) and we can reduce the number of inference steps to just 2 to 8 steps.
35
+ Please make sure to either disable `guidance_scale` or use values between 1.0 and 2.0.
36
+
37
+ ```python
38
  from diffusers import UNet2DConditionModel, DiffusionPipeline, LCMScheduler
39
 
40
  unet = UNet2DConditionModel.from_pretrained("latent-consistency/lcm-sdxl", torch_dtype=torch.float16, variant="fp16")
 
46
  prompt = "a red car standing on the side of the street"
47
 
48
  image = pipe(prompt, num_inference_steps=4, guidance_scale=8.0).images[0]
49
+ ```
50
+
51
+ ![](./image.png)
52
+
53
+ ### Image-to-Image
54
+
55
+ Works as well! TODO docs
56
+
57
+ ### Inpainting
58
+
59
+ Works as well! TODO docs
60
+
61
+ ### ControlNet
62
+
63
+ Works as well! TODO docs
64
+
65
+ ### T2I Adapter
66
+
67
+ Works as well! TODO docs
68
+
69
+ ## Speed Benchmark
70
+
71
+ TODO
72
+
73
+ ## Training
74
+
75
+ TODO