Inspired by Ezra Erives and Jiarui Hai
This repository provides the codebase and environment setup for the Flow Matching experiment, designed to deliver a clean, minimal, and extensible framework.
# clone the repository
git clone https://github.com/hanbinzheng/flow-matching.git
cd flow-matchingIf you are using WSL, install the appropriate python3-venv package before proceeding. To detect and install the correct package version, run:
# install python3-venv package for wsl users
ver=$(python3 --version 2>&1 | awk '{print $2}' | cut -d. -f1,2)
sudo apt install -y python${ver}-venvThen, execute the environment setup script:
# set up the environment
chmod +x setup_env.sh
./setup_env.shThis process may take several minutes depending on your internet connection. Please be patient.
# run the training code
source .venv/bin/activate
python train.pyTraining duration depends on your hardware configuration, but typically completes within an hour.
Training outputs will be saved under the flow-matching/results/ directory.
-
The
setup_env.shscript automates the creation of a Python virtual environment, upgrades pip, installs required packages (excluding PyTorch), detects your system’s CUDA version, and installs the appropriate PyTorch build accordingly. -
This setup supports WSL, macOS, Ubuntu, and the vast majority of Unix-like operating systems.
-
CPU-only training is fully supported, with automatic adaptation for environments lacking compatible GPUs. -
The .venv directory is excluded from version control to maintain a clean repository.
-
(
Only for GPU Training) Multi-GPU configurations are not supported by the automated setup and require manual intervention. -
(
Only for GPU Training) Ensure NVIDIA drivers and CUDA are properly installed, and that the nvidia-smi command is available for CUDA-based GPU detection. -
For troubleshooting installation issues, consult the
packages_install_log.txtfile generated during setup (only for those who failed the2: Set up the environment).
This setup guarantees a reproducible and efficient environment for your Flow Matching experiments.

