latent-consistency-model  by luosiallen

LCM: Fast image synthesis via few-step inference

Created 1 year ago
4,558 stars

Top 10.8% on SourcePulse

GitHubView on GitHub
Project Summary

Latent Consistency Models (LCM) offer a method for significantly accelerating image generation from diffusion models, enabling high-quality synthesis with very few inference steps. This project targets researchers and developers working with text-to-image and image-to-image generation, providing a substantial reduction in inference time and computational cost.

How It Works

LCM achieves fast inference by distilling classifier-free guidance into the model's input, effectively reducing the number of required sampling steps. This approach allows for high-quality image generation in as few as 1-8 steps, a dramatic improvement over traditional diffusion models that often require dozens or hundreds of steps. The core innovation lies in this distillation process, making the models more efficient without sacrificing output quality.

Quick Start & Requirements

  • Install: pip install --upgrade diffusers transformers accelerate
  • Prerequisites: PyTorch (CUDA recommended), Python 3.8+. Intel Extension for PyTorch for Intel GPUs. MPS support for MacOS.
  • Usage: Load models via diffusers.DiffusionPipeline.from_pretrained("SimianLuo/LCM_Dreamshaper_v7").
  • Demos & Docs: Hugging Face Demo, Replicate Demo, Official Docs.

Highlighted Details

  • Supports text-to-image and image-to-image generation.
  • Integrates official LCM pipelines and schedulers in the diffusers library.
  • Offers LCM-LoRA for universal Stable-Diffusion acceleration.
  • Real-time inference capabilities demonstrated.
  • Supports local execution via Gradio UI, SD-Webui, and ComfyUI.

Maintenance & Community

The project is actively maintained with recent updates including training scripts and LCM-LoRA. Community discussions are encouraged on LCM Discord channels.

Licensing & Compatibility

The project does not explicitly state a license in the README. However, the underlying diffusers library is typically Apache 2.0 licensed, which generally permits commercial use and linking with closed-source projects.

Limitations & Caveats

While LCM supports fast inference, using torch.float16 for memory saving may compromise image quality. The project also mentions older usages being deprecated in favor of the official diffusers integration.

Health Check
Last Commit

1 year ago

Responsiveness

Inactive

Pull Requests (30d)
0
Issues (30d)
0
Star History
13 stars in the last 30 days

Explore Similar Projects

Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Zhiqiang Xie Zhiqiang Xie(Coauthor of SGLang), and
1 more.

Sana by NVlabs

0.4%
4k
Image synthesis research paper using a linear diffusion transformer
Created 11 months ago
Updated 5 days ago
Starred by Yineng Zhang Yineng Zhang(Inference Lead at SGLang; Research Scientist at Together AI), Rodrigo Nader Rodrigo Nader(Cofounder of Langflow), and
1 more.

DiffSynth-Studio by modelscope

0.9%
10k
Open-source project for diffusion model exploration
Created 1 year ago
Updated 13 hours ago
Feedback? Help us improve.