đ Latent Consistency Model (LCM): SSD-1B
Latent Consistency Model (LCM) enables high - resolution image synthesis with few - step inference, significantly enhancing efficiency in text - to - image tasks.
đ Quick Start
LCM SDXL is supported in đ¤ Hugging Face Diffusers library from version v0.23.0 onwards. To run the model, first install the latest version of the Diffusers library as well as peft
, accelerate
and transformers
.
pip install --upgrade pip
pip install --upgrade diffusers transformers accelerate peft
⨠Features
Latent Consistency Model (LCM) was proposed in Latent Consistency Models: Synthesizing High - Resolution Images with Few - Step Inference by Simian Luo, Yiqin Tan et al. and Simian Luo, Suraj Patil, and Daniel Gu successfully applied the same approach to create LCM for SDXL. This checkpoint is a LCM distilled version of segmind/SSD-1B
that allows to reduce the number of inference steps to only between 2 - 8 steps.
đĻ Installation
To install the necessary libraries for running the model, execute the following commands:
pip install --upgrade pip
pip install --upgrade diffusers transformers accelerate peft
đģ Usage Examples
Basic Usage
The model can be loaded with its base pipeline segmind/SSD-1B
. Next, the scheduler needs to be changed to LCMScheduler
and we can reduce the number of inference steps to just 2 to 8 steps.
from diffusers import UNet2DConditionModel, DiffusionPipeline, LCMScheduler
import torch
unet = UNet2DConditionModel.from_pretrained("latent-consistency/lcm-ssd-1b", torch_dtype=torch.float16, variant="fp16")
pipe = DiffusionPipeline.from_pretrained("segmind/SSD-1B", unet=unet, torch_dtype=torch.float16, variant="fp16")
pipe.scheduler = LCMScheduler.from_config(pipe.scheduler.config)
pipe.to("cuda")
prompt = "a close-up picture of an old man standing in the rain"
image = pipe(prompt, num_inference_steps=4, guidance_scale=1.0).images[0]

Advanced Usage
- Image - to - Image: Works as well! TODO docs
- Inpainting: Works as well! TODO docs
- ControlNet: Works as well! TODO docs
- T2I Adapter: Works as well! TODO docs
đ Documentation
Text - to - Image
The model can be loaded with its base pipeline segmind/SSD-1B
. Then, change the scheduler to LCMScheduler
and reduce the number of inference steps to 2 - 8 steps.
đ License
The license for this model is openrail++.
Property |
Details |
Library Name |
diffusers |
Base Model |
stabilityai/stable - diffusion - xl - base - 1.0 |
Tags |
text - to - image |
License |
openrail++ |
Inference |
false |