Skip to content

PyTorch implementation of Flow Matching on toy examples

Notifications You must be signed in to change notification settings

lmartinez2001/flow-matching

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flow Matching

Flow Matching Evolution

Setup

This project uses uv.

  1. Clone the repository:
git clone https://github.com/lmartinez2001/flow-matching
cd flow-matching
  1. Install dependencies:
uv sync

Usage

Training the Model

Train a flow matching model on the two moons dataset:

uv run train.py

This will:

  • Generate a synthetic two moons dataset
  • Train an MLP to learn the vector field
  • Save the trained model to out/model.pth
  • Save training losses to out/losses.npy

Training parameters can be modified in train.py:

  • lr: Learning rate (default: 1e-4)
  • epochs: Number of training epochs (default: 1000)
  • batch_size: Batch size (default: 4096)
  • n_samples: Number of training samples (default: 8192)

Generating Visualizations

Create animated visualizations of the learned flow:

uv run visualize.py

This will generate:

  • Vector field visualizations showing the learned flow at different time steps
  • Flow evolution animations showing how samples are transported from noise to data
  • GIF saved to out/animations/flow_matching.gif

References

About

PyTorch implementation of Flow Matching on toy examples

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages