piecewise-rectified-flow  by magic-research

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

Created 1 year ago
526 stars

Top 60.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 week ago

Responsiveness

Inactive

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

Explore Similar Projects

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 16 hours ago
Starred by Chip Huyen Chip Huyen(Author of "AI Engineering", "Designing Machine Learning Systems"), Luca Antiga Luca Antiga(CTO of Lightning AI), and
2 more.

mmagic by open-mmlab

0.1%
7k
AIGC toolbox for image/video editing and generation
Created 6 years ago
Updated 1 year ago
Feedback? Help us improve.