Avoid running `on_training_end` after Keyboard Interrupt
See original GitHub issue🚀 Feature
Right now, due to #795 , on_training_end
runs after a KeyboardInterrupt
. This ends up running code that’s meant to be run only after successful training completion. This feature should either be reverted, or an alternative should be provided, so as to run some code only after successful training.
Motivation
I am training a model on Sagemaker and have added a notebook shutdown code within the on_training_end
method. There were times where I had to manually cancel my model training because some parameters were incorrect. However, If I do that, the notebook shuts down immediately. This is because the on_training_end
method runs even after a KeyboardInterrupt
. I don’t want my notebook shutting down after a keyboard interrupt, only after successful training completion.
Pitch
Maybe add an on_training_completed
method for code that’s meant to be run after successful training.
Issue Analytics
- State:
- Created 4 years ago
- Reactions:1
- Comments:20 (18 by maintainers)
@jeremyjordan sounds like a good idea! also I was thinking that since we have TrainerStatus, can it be the main class while TrainerMode servers as a nested enum instead of putting them all under a single enum? something like:
then user can access the current status and mode through:
not too sure about that, but probably the order matters too when new status or mode is added. so I guess we should use exact numbers like you suggested in case any import or export is involved! 🙂