lucidrains/rectified-flow-pytorch
Implementation of rectified flow and some of its followup research / improvements in Pytorch
What it solves
This project provides a PyTorch implementation of Rectified Flow, a generative modeling technique designed to make the path between noise and data more direct (straight), which simplifies the sampling process and improves efficiency.
How it works
It implements the core Rectified Flow algorithm and several subsequent research improvements. The library allows users to define a model (such as a UNet) and wrap it in a RectifiedFlow class to handle the training loss and sampling. It also supports "reflow"—a process of iteratively refining the flow to further straighten the trajectories, potentially enabling faster generation.
Who it’s for
Researchers and developers working on generative AI, specifically those interested in flow-matching and alternatives to traditional diffusion models for image synthesis.
Highlights
- Reflow Support: Includes the
Reflowclass to iteratively straighten the generative paths. - Integrated Trainer: Provides a
Trainerbased on theacceleratelibrary for easier model training. - Diverse Implementations: Includes advanced variants like LSD flow, SoFlow, Split Mean Flow, Unconstrained Alignment (UA) Flow, and Laplacian multiscale flow matching.
- Ready-to-use Components: Comes with a built-in
UnetandImageDatasetfor quick experimentation.
Related
- Project
- Project
- Project
- Project
- Project