haidog-yaqub/MeanFlow
PyTorch implementation of MeanFlow & iMF (one-step generative modeling).
What it solves
MeanFlow provides a PyTorch implementation of Mean Flows and Improved Mean Flows (iMF), which are designed for one-step generative modeling. This allows for high-quality image generation from noise in a single step, bypassing the slower multi-step sampling process typical of many diffusion models.
How it works
The project implements two modes of operation: meanflow and i-meanflow (the latter being more stable and recommended). It uses a Dual-head Diffusion Transformer (DiT) architecture where one head (u) handles MeanFlow and the other (v) handles flow matching. It also supports Classifier-Free Guidance (CFG) distillation to improve sample quality.
Who it’s for
Researchers and developers working on fast generative models, specifically those interested in one-step image generation and flow-based modeling in PyTorch.
Highlights
- One-Step Generation: Capable of producing samples from datasets like MNIST, CIFAR-10, and ImageNet (latent) in a single step.
- Dual-head DiT: Implements a specialized transformer architecture to support both MeanFlow and flow matching.
- Multi-GPU Support: Integrated with Hugging Face Accelerate for efficient training across multiple GPUs.
- CFG Distillation: Supports Classifier-Free Guidance scale as model input for better control over generation.