Enforce saving at end of training if saving option chosen (#30160)

* Enforce saving at end of training

* Fix test

* Rework test

* Fixup tests'

* Update comment based on sourab feedback

* Clean
This commit is contained in:
Zach Mueller
2024-05-21 07:50:11 -04:00
committed by GitHub
parent 7a4792e6b3
commit daf281f44f
4 changed files with 58 additions and 1 deletions

View File

@@ -153,7 +153,7 @@ class TrainerCallbackTest(unittest.TestCase):
expected_events.append("on_log")
if trainer.args.eval_strategy == IntervalStrategy.STEPS and step % trainer.args.eval_steps == 0:
expected_events += evaluation_events.copy()
if step % trainer.args.save_steps == 0:
if step % trainer.args.save_steps == 0 or step == trainer.state.max_steps:
expected_events.append("on_save")
expected_events.append("on_epoch_end")
if trainer.args.eval_strategy == IntervalStrategy.EPOCH: