A small PyTorch training loop, done properly: data loading, model, training loop, validation, checkpointing, and honest metrics. PyTorch handles the autograd and optimizers; fastai is available as an optional higher-level alternative.
An earlier NumPy-only implementation of backprop is still in the repo under src/nn_from_scratch/ if you want to see the math without a framework in the way — CONCEPTS.md walks through what PyTorch is doing for you instead.
Can a clean PyTorch train/eval loop on small data produce honest metrics, with the failure modes written down?
python -m venv .venv && . .venv/bin/activate && pip install torch --index-url https://download.pytorch.org/whl/cpu && pip install -r requirements.txt && python scripts/train_torch.py --epochs 50Or, if your environment already has the dependencies:
make reproduceEither way, this trains a small MLP on the moons dataset for 50 epochs and saves loss curves, a confusion matrix, and the best checkpoint to artifacts/.
python -m venv .venv
source .venv/bin/activate
# CPU-only PyTorch keeps the install light
pip install torch --index-url https://download.pytorch.org/whl/cpu
pip install -r requirements.txt
python scripts/train_torch.py --epochs 50
# or the fastai-style version
pip install .[fastai]
python scripts/train_fastai.py --epochs 50report.md covers the setup, the metrics, a confusion matrix, and what I'd try next. CONCEPTS.md covers what autograd and optimizers are actually doing under the hood.