Flow matching in PyTorch, from toy data to ImageNet
This library turns the Flow Matching guide into runnable PyTorch code, complete with solvers, paths, and training recipes for images and text.

What it does
flow_matching is Meta’s PyTorch translation of the Flow Matching guide. It breaks the theory into practical pieces—losses, paths, schedulers, and solvers—and bundles training recipes for everything from toy 2D datasets to face-blurred ImageNet and text. Think of it as a build-your-own-generative-model kit with the math already filled in.
The interesting bit
Instead of a single reference implementation, the library treats flow matching as a configurable pipeline. You can mix and match paths and solvers, which means experimenting with Riemannian variants or discrete token flows does not require gutting an entire training script. It is explicitly designed to be read alongside the arXiv paper.
Key highlights
- Covers continuous, discrete, and Riemannian flow matching in one codebase.
- End-to-end training examples for images (CIFAR-10, face-blurred ImageNet) and text.
- Modular architecture:
loss,path,scheduler, andsolverare swappable components. - No pre-trained checkpoints; every example is train-from-scratch by design.
- CC BY-NC 4.0 license, so keep it in the lab.
Caveats
- No pre-trained models are released, so reproducing larger-scale results requires significant compute.
- The CC BY-NC license prohibits commercial use unless you negotiate separately with Meta.
- Requires Python 3.9 and PyTorch 2.1 or newer.
Verdict
Ideal for researchers who want a clean, modular PyTorch baseline for flow matching experiments. Skip it if you are looking for production-ready weights or a permissive commercial license.
Frequently asked
- What is facebookresearch/flow_matching?
- This library turns the Flow Matching guide into runnable PyTorch code, complete with solvers, paths, and training recipes for images and text.
- Is flow_matching open source?
- Yes — facebookresearch/flow_matching is an open-source project tracked on heatdrop.
- What language is flow_matching written in?
- facebookresearch/flow_matching is primarily written in Python.
- How popular is flow_matching?
- facebookresearch/flow_matching has 4.6k stars on GitHub.
- Where can I find flow_matching?
- facebookresearch/flow_matching is on GitHub at https://github.com/facebookresearch/flow_matching.