nano-t2i
A minimal, hackable codebase to train a text-to-image flow matching model end-to-end on a single H200 GPU for under $300
nano-t2i is a minimal, hackable and fully open codebase to reproducibly train a
text-to-image flow matching model end-to-end on the
MONET dataset — from raw shards to a working Gradio demo
in two commands, on a single H200 GPU, for under $300.
The model
A 1.3B DiT-style flow matching model pairing a Qwen3-4B text encoder with a
SANA VAE latent backbone. The nano config stacks 5 dual-stream and 5
single-stream DiT blocks with 24 attention heads of 128 dimensions each, relies on
AdaLN sharing and is initialized with AdaLN-Zero. Everything is built on top of
PyTorch Lightning and diffusers, and every architectural choice lives in a single
YAML config, so the whole thing stays small enough to fit on one GPU and simple
enough to take apart.
Training runs in two sequential phases: 200k steps at 512×512, then 500k steps at 1024×1024 resumed from the first phase. FlashAttention v3 is supported as well.
Training on a budget
The headline result is how little it costs to go from nothing to a working text-to-image model. Counting at roughly $3 per H200 per hour:
| Resolution | Hardware | Wall time | Cost |
|---|---|---|---|
| 512 | 1×H200 | 24 h | ~$72 |
| 512 | 1×H200 | 36 h | ~$108 |
| 1024 | 1×H200 | 48 h | ~$144 |
| 1024 | 1×H200 | 60 h | ~$180 |
| 1024 | 1×H200 | 72 h | ~$216 |
Data
Training uses MONET, a 104.9M image-text corpus distilled from 2.9B raw pairs across nine open sources, with safety filtering, pHash and SSCD deduplication, domain governance and multi-VLM re-captioning. It ships pre-computed SANA-VAE latents so you can train in latent space directly, and is released under Apache-2.0 — as is this codebase.
The same code was used to train the 4B model reported in the MONET paper.