latent-consistency-model  by luosiallen

LCM: Fast image synthesis via few-step inference

created 1 year ago
4,544 stars

Top 11.0% 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

1 day

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

Explore Similar Projects

Starred by Patrick von Platen Patrick von Platen(Core Contributor to Hugging Face Transformers and Diffusers), Travis Fischer Travis Fischer(Founder of Agentic), and
3 more.

consistency_models by openai

0.0%
6k
PyTorch code for consistency models research paper
created 2 years ago
updated 1 year ago
Starred by Dan Abramov Dan Abramov(Core Contributor to React), Patrick von Platen Patrick von Platen(Core Contributor to Hugging Face Transformers and Diffusers), and
28 more.

stable-diffusion by CompVis

0.1%
71k
Latent text-to-image diffusion model
created 3 years ago
updated 1 year ago
Feedback? Help us improve.