NN Trainer Library
A library for automatic supervised training of neural network models — handles training loops, logging, checkpointing, and hyperparameter scheduling so you can focus on architecture.
Why this exists
Writing a training loop from scratch for every new neural network experiment is mechanical work that has nothing to do with the research question. This library absorbs that boilerplate.
Problem
Every training script reimplements the same patterns: epoch loops, validation, checkpoint saving, loss logging, learning rate scheduling. The duplication is error-prone and distracts from model development.
What was built
A lightweight Python library that provides:
- A
Trainerclass that manages the full supervised training lifecycle - Automatic checkpoint saving and resume
- Configurable metric logging (console, TensorBoard)
- Pluggable learning rate schedulers
- Early stopping with patience
Results
Used across multiple personal projects. Reduced training script boilerplate from ~120 lines to ~15 lines of configuration.
Technical architecture
Trainer
├── DataLoaderPair (train / val)
├── Optimizer + Scheduler
├── MetricLogger
└── CheckpointManager
Training loop is intentionally minimal — the library doesn’t try to abstract the model itself, only the loop infrastructure around it.