piecewise-rectified-flow  by magic-research

PeRFlow: Plug-and-play accelerator for diffusion models (NeurIPS 2024)

created 1 year ago
524 stars

Top 61.1% on sourcepulse

GitHubView on GitHub
Project Summary

PeRFlow offers a novel approach to accelerate pre-trained diffusion models, enabling high-quality image generation in as few as 4 steps. Targeting researchers and developers working with Stable Diffusion, it provides a plug-and-play module that significantly reduces sampling time while maintaining or improving generation quality compared to existing methods like LCM.

How It Works

PeRFlow learns a piecewise linear probability flow by dividing the diffusion process into segments and applying a "reflow" operation to each. This "divide-and-conquer" strategy avoids the computationally expensive simulation of the entire ODE trajectory required by prior methods, allowing for efficient online training. The core innovation is the learned $\Delta W$ (difference in model weights), which can be fused with existing Stable Diffusion models as a universal accelerator.

Quick Start & Requirements

  • Install dependencies with env/install.sh.
  • Requires PyTorch and Hugging Face diffusers (v0.19.3 recommended for specific applications).
  • GPU with CUDA is necessary for inference and training.
  • Pre-trained delta-weights for SD-v1.5 and SDXL are available on Hugging Face.
  • Official project page: https://piecewise-rectified-flow.github.io
  • Tech Report: https://arxiv.org/abs/2405.07510

Highlighted Details

  • Achieves high-fidelity image generation in 4 steps, outperforming LCM in diversity and quality.
  • Fine-tuning converges significantly faster than InstaFlow (4k vs. 25k iterations).
  • $\Delta W$ module is compatible with various SD pipelines (ControlNet, IP-Adapter, multi-view generation).
  • Supports classifier-free guidance and negative prompts.

Maintenance & Community

  • Active development with recent releases of SDXL and training scripts.
  • Contributions are welcomed.
  • Related projects: Rectified Flow, InstaFlow.

Licensing & Compatibility

  • The repository itself does not explicitly state a license.
  • Models released on Hugging Face are typically under permissive licenses (e.g., MIT for diffusers), but specific model licenses should be checked.
  • Designed for compatibility with existing Stable Diffusion workflows and fine-tuned models.

Limitations & Caveats

The project is presented as a research artifact with NeurIPS 2024 publication. While delta-weights are provided, users may need to fuse them with their specific base models, requiring careful implementation. The "universal plug-and-play" claim is demonstrated across several applications, but extensive testing across all possible SD variants might be needed.

Health Check
Last commit

1 year ago

Responsiveness

1+ week

Pull Requests (30d)
0
Issues (30d)
0
Star History
21 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.