A Copier template for ML research projects — PyTorch or JAX, typed configs, uv,
with multi-seed significance testing and copier update baked in.
Documentation • Getting started • 15-minute tutorial • Hands-on tour • The stack (and why)
Generate a project in ~30 seconds.
uv tool install copier
copier copy --trust gh:loevlie/ml-research-template my-project
cd my-project
uv run python src/<your_package_name>/train.pyAnswer ~10 prompts, get a ready-to-train project: git initialized, deps locked, pre-commit installed.
-
⚡ Fabric, not Trainer. An explicit training loop you can read and edit — with checkpoint resume, warmup+cosine LR scheduling, and gradient accumulation already wired in, config-driven. No callbacks, no hidden machinery. Prefer JAX?
-d framework=jaxgenerates a flax NNX + optax core with the same configs and commands. -
⚡ Statistical rigor on day one. Multi-seed launchers (local + SLURM array) and an aggregator with bootstrap CIs, paired Wilcoxon/t-tests, and Cohen's d. Publication-ready out of the box.
-
⚡ Typed configs, familiar CLI. pydantic schemas your IDE checks, parsed with the Hydra-style
experiment=x loss=contrastive model.lr=1e-3syntax — typos die at parse time, not at epoch 40. -
⚡ Domain flavors.
tabularadds OpenML task loading, an sklearn-estimator wrapper, TabPFN/TabICL baselines, and a code-version-aware cached benchmark harness (exca).multimodaladds timm/open_clip/HF-datasets plumbing and a CLIP-style contrastive objective. -
⚡ SLURM-native.
sweep.py/tune.pyfan out as job arrays via submitit, sbatch scripts cover the rest — with preemption auto-resume (requeued jobs continue fromlast.ckpt). -
⚡ Runtime shape checking via
@jaxtyped(typechecker=beartype)— broadcasting bugs die on the first forward pass, not after a day of training. -
⚡ Copier-native.
copier updatepulls template improvements into existing projects without clobbering your work — the compounding win across multiple projects.
Learn it by doing it: the 15-minute tutorial takes a real dataset to a publication-grade number, and the hands-on tour continues into sweeps, Optuna, crash recovery, and a paired significance test — every output on those pages is from a real run. The tutorial also exists as an interactive walkthrough (a scrollable code tour of every key line) backed by a browsable repo, one commit per step: wine-quality-example. The docs also pack a one-page cheatsheet, per-workflow guides with diagrams, and interactive widgets (a live bootstrap-CI demo, a CLI command builder, a what-gets-generated explorer).
- You want a Lightning
Trainerblack box → use lightning-hydra-template. - You work in TensorFlow → not for you (PyTorch and JAX are).
- You don't want to own the CLI code (one ~250-line file you can read) → use a framework instead.
- You need multi-node pretraining scaffolding → crib torchtitan.
cd path/to/existing-project
copier update --trustTemplate improvements merge in three-way; files you own (model, data, configs, README) are never clobbered. Details.
MIT