Lesson 12 / Unit 4: Training Experiments
Training Loop
Train the random-weight recognizer and save enough evidence to explain every checkpoint.
The model does learn this constrained task, but it does not become a reliable general recognizer. The recorded 60-epoch run took 52.249 seconds for training plus per-epoch validation on an ARM Mac CPU with four PyTorch threads. Dataset preparation and later evaluation are outside that timer.
Run Training
python lab.py --data fsdd --out my-run --epochs 60 --threads 4The run uses seed 17, batches of 16, AdamW at learning rate 0.002 and gradient clipping at norm five. These settings describe this experiment; they are not defaults for every speech model. Hardware, library versions and numerical kernels can change results.
opt.zero_grad()log_probs, lengths = model(x, input_lengths)loss = criterion(log_probs, targets, lengths, target_lengths)if not torch.isfinite(loss): raise ValueError('Inspect CTC lengths and targets')loss.backward()torch.nn.utils.clip_grad_norm_(model.parameters(), 5)opt.step()Small Sanity Run
Before modifying the architecture, use a tiny fixed set and confirm that training can memorise it. That checks the relationship between features, targets, lengths and decoding; it is not an accuracy result. The overfit.py exercise performs this check. In the recorded sanity run, all eight training examples matched after 300 updates. That result measures memorisation only; it does not improve the held-out score.
If memorisation fails, inspect one decoded path and its label before adding layers. A wrong blank index cannot be fixed by more compute.
Saved Evidence
| File | Purpose |
|---|---|
manifest.json | Source recordings and split membership |
history.json | Training loss and validation decoding by epoch |
best.pt | Checkpoint chosen using validation digit error rate |
results.json | Evaluation predictions, runtime scope and provenance |
The lab code and pinned requirements are in the download. The loss uses the documented CTC API.
Read Learning Curves before interpreting the log, and preserve the split disclosure from Speaker Splits.
We do this work for teams shipping voice agents: Self-Hosted Voice Agent .
Edit this lesson on GitHub ↗Discussion
Questions, corrections and war stories welcome. Sign in with GitHub to comment.