Skip to content

About

Practical deep learning with PyTorch: clean train/val loop on small data with honest metrics.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Practical deep learning with PyTorch

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.

Research question

Can a clean PyTorch train/eval loop on small data produce honest metrics, with the failure modes written down?

Quick reproduction

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 50

Or, if your environment already has the dependencies:

make reproduce

Either 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/.

Step by step

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 50

What's in the report

report.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.

About

Practical deep learning with PyTorch: clean train/val loop on small data with honest metrics.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages