Blazingly slow flow matching model DDP training/generation implemented with LibTorch
- vcpkg
- cmake
- ninja
- OpenCV
- CIFAR-100 dataset (i.e.
cifar-100-binary/train.bin) - connection to GitHub
- (optional) astral uv
- (optional) ffmpeg
At root of this repo:
uv venv && . .venv/bin/activate && uv pip install torch(i.e. install LibTorch)cmake --preset linux && cd build/linuxninja nn
cd build/linux./nn config -t -mto generate JSON configuration files- Edit the configuration files
./nn train model.json train.jsonto train from scratch
To train with Distributed-Data-Parallel (DDP), launch multiple instances of the application nn with different --rank, --local-rank, --world-size, --local-world-size commandline options. (See ./nn train -h for details)
cd build/linux./nn config -eto generate JSON configuration file- Edit the configuration file
- Run
./nn eval model.json DiT_4000.pt eval.jsonto generate with model weights fromDiT_4000.pt - The generation results are saved to
generated_image.png(and optionally anoutput.mp4) under CWD
Note: by default, the generation process will be captured as an MP4 output.mp4 by piping every frame to FFmpeg. Compile with template variable Visual = false in torch.cpp to disable.
Documentation, boilerplates and LibTorch internals discovering.