Repository navigation
Do not train another epoch when resuming a run that was stopped early - #6865
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (2)
Included review availability: This review used your included allowance. Your plan provides up to 8 included reviews per hour; 2 remain after this review. 📝 WalkthroughWalkthroughWhen training resumes after epoch 1, Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix Suggested reviewers: Merge Risk: ⚪ Minimal · up to The change appears ready to merge after normal checks; no actionable resume-time risk remains. 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)✅ Passed checks (4 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6865 +/- ##
=======================================
Coverage 74.47% 74.47%
=======================================
Files 910 910
Lines 83766 83768 +2
=======================================
+ Hits 62381 62386 +5
+ Misses 21385 21382 -3
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This pull request does not currently match the merge queue conditions, so it cannot be queued from here. The box comes back if it matches again. |
What did you change?
Trainer.runchecks the restored reporter for early stopping before entering the epoch loop. If the current patience is already exhausted, it skips training and still runs final model averaging. Increasing or disabling patience allows training to continue.Why did you make this change?
Recipe scripts pass
--resume true. After a run stops early, repeating the same training command currently trains and saves one extra epoch before checking patience again. Each restart adds another epoch.Reproduced with the stock Trainer and a small Conformer/RNN transducer using the native warp-transducer loss, log-mel speech features and Adam. It trained on two public LibriSpeech recordings and validated on two different recordings (21.175 seconds total). Validation loss reached its minimum at epoch 13 and worsened at epochs 14 and 15, so
patience=1stopped training naturally.With this change, both restarts leave
checkpoint.pthbyte-for-byte unchanged. On master, the second restart changes 56 trainable parameter tensors (maximum absolute change 0.04975). Increasing patience from 1 to 4 resumes epochs 16-18 with this change, as intended. The best-two averaged model stayed unchanged in this experiment on both versions; this is a restart/checkpoint correctness check, not an accuracy improvement claim.The regression tests use a tiny constant-loss model to reproduce the same restart behavior quickly and check that a larger patience still continues training.
Is your PR small enough?
Yes. Eleven source lines and one test file. The test setup supplies
TrainerOptions, whose fields have no defaults.Additional Context
Reporter.check_early_stoppingcall as the end of an epoch. No new checkpoint state or format change.pytest --no-cov --execution-timeout=10 test/espnet2/train/test_reporter.py test/espnet2/train/test_trainer.py: 38 passed. The new repeated-resume test fails on current master. Pre-commit and CI flake8 checks pass.