TCD  by jabir-zheng

Distillation method for fast, high-quality image generation

created 1 year ago
347 stars

Top 81.1% on sourcepulse

GitHubView on GitHub
1 Expert Loves This Project
Project Summary

This repository provides the official implementation for Trajectory Consistency Distillation (TCD), a novel distillation technology designed to accelerate pre-trained diffusion models for few-step image generation. It offers a flexible alternative to existing acceleration methods like LCM-LoRA, aiming for superior quality and versatility across various diffusion model backbones and community adaptations.

How It Works

TCD is inspired by Consistency Models and leverages exponential integrators to design an effective consistency function. This approach allows for flexible Number of Function Evaluations (NFEs) without the significant quality degradation seen in other methods at higher NFEs. Unlike adversarial distillation methods, TCD avoids mode collapse and "Janus" artifacts, producing more realistic and diverse outputs.

Quick Start & Requirements

  • Install: pip install diffusers transformers accelerate peft
  • Prerequisites: CUDA-enabled GPU, Python 3.8+
  • Usage: Integrated with the Hugging Face Diffusers library. LoRA checkpoints are available on Hugging Face Hub.
  • Demo: A Gradio demo is available locally (python gradio_app.py), and a Colab demo is provided.
  • Official Docs: Diffusers Integration

Highlighted Details

  • Achieves few-step generation with flexible NFEs, outperforming SDXL Base with DPM-Solver++(2S) at high NFEs.
  • Allows free adjustment of image detail via a single hyperparameter, gamma.
  • Demonstrates versatility by integrating with LoRA, ControlNet (Depth, Canny), and IP-Adapter for accelerated generation with custom models.
  • Avoids adversarial training, circumventing mode collapse and producing more realistic results than methods like SDXL-Lightning.

Maintenance & Community

The project has seen recent integration into the Diffusers library and has released LoRA checkpoints for SDv1.5 and SDv2.1. A ComfyUI plugin is also available. The project acknowledges contributions from the Diffusers team and community members.

Licensing & Compatibility

The repository's license is not explicitly stated in the README. However, its heavy reliance on the Hugging Face Diffusers library suggests compatibility with its Apache 2.0 license. Commercial use is likely permitted, but verification of the specific license for the TCD code and models is recommended.

Limitations & Caveats

The README prominently features a statement addressing plagiarism allegations from the CTM team, detailing communication and differences between the methods. While the project claims superior performance, direct comparative benchmarks against all concurrent works are not provided.

Health Check
Last commit

1 year ago

Responsiveness

1 week

Pull Requests (30d)
0
Issues (30d)
0
Star History
11 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
Feedback? Help us improve.