Skip to main content

Flow Matching for Generative Modeling

Project description

Flow Matching

arXiv CI Coverage License: CC BY-NC 4.0 PyPI

flow_matching is a PyTorch library for Flow Matching algorithms, featuring continuous and discrete implementations. It includes examples for both text and image modalities. This repository is part of Flow Matching Guide and Codebase.

Installation

This repository requires Python 3.9 and Pytorch 2.1 or greater. To install the latest version run:

pip install flow_matching

Repository structure

The core and example folders are structured in the following way:

.
├── flow_matching                  # Core library   ├── loss                       # Loss functions      └── ...
│   ├── path                       # Path and schedulers      ├── ...
│      └── scheduler              # Schedulers and transformations          └── ...
│   ├── solver                     # Solvers for continuous and discrete flows      └── ...
│   └── utils
│       └── ...
└── examples                       # Synthetic, image, and text examples
    ├── ...
    ├── image
           └── ...
    └── text 
            └── ...

Development

To create a conda environment with all required dependencies, run:

conda env create -f environment.yml
conda activate flow_matching

Install pre-commit hook. This will ensure that all linting is done on each commit

pre-commit install

Install the flow_matching package in an editable mode:

pip install -e .

FAQ

I want to train a Flow Matching model, where can I find the training code?

We provide training examples. Under this folder, you can find synthetic data for continuous, discrete, and Riemannian Flow Matching. We also provide full training examples (continuous and discrete) on CIFAR10 and face-blurred ImageNet, and a scalable discrete Flow Matching example for text modeling.

Do you release pre-trained models?

In this version, we don't release pre-trained models. All models under examples can be trained from scratch by a single running command.

How to contribute to this codebase?

Please follow the contribution guide.

License

The code in this repository is CC BY-NC licensed. See the LICENSE for details.

Citation

If you found this repository useful, please cite the following.

@misc{lipman2024flowmatchingguidecode,
      title={Flow Matching Guide and Code}, 
      author={Yaron Lipman and Marton Havasi and Peter Holderrieth and Neta Shaul and Matt Le and Brian Karrer and Ricky T. Q. Chen and David Lopez-Paz and Heli Ben-Hamu and Itai Gat},
      year={2024},
      eprint={2412.06264},
      archivePrefix={arXiv},
      primaryClass={cs.LG},
      url={https://arxiv.org/abs/2412.06264}, 
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flow_matching-1.0.10.tar.gz (33.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

flow_matching-1.0.10-py3-none-any.whl (48.7 kB view details)

Uploaded Python 3

File details

Details for the file flow_matching-1.0.10.tar.gz.

File metadata

  • Download URL: flow_matching-1.0.10.tar.gz
  • Upload date:
  • Size: 33.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.19

File hashes

Hashes for flow_matching-1.0.10.tar.gz
Algorithm Hash digest
SHA256 b9cebb2534a1bead4fd8b6af9269cf75da88335adec629865be41e5f93bf5821
MD5 73e41931bdecf2a140285ff67c1fe9ce
BLAKE2b-256 525de92c12d1df3d685c595371a9dcae5ce4c79d0e095c07217b80d02bfe5333

See more details on using hashes here.

File details

Details for the file flow_matching-1.0.10-py3-none-any.whl.

File metadata

  • Download URL: flow_matching-1.0.10-py3-none-any.whl
  • Upload date:
  • Size: 48.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.0.1 CPython/3.9.19

File hashes

Hashes for flow_matching-1.0.10-py3-none-any.whl
Algorithm Hash digest
SHA256 9e7bb6c51b5804bbb1450f59fbd04e2f843adc0b7665d0f4f341f420dce04136
MD5 a633c46a2b795129f3f62e720d34ee0c
BLAKE2b-256 051380d356a38b976df17be3fc3208da468488d5af7437aab4a694cd35432610

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page