Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support graceful training cleanup after Keyboard Interrupt #795

Closed
jeremyjordan opened this issue Feb 6, 2020 · 7 comments · Fixed by #856
Closed

support graceful training cleanup after Keyboard Interrupt #795

jeremyjordan opened this issue Feb 6, 2020 · 7 comments · Fixed by #856
Assignees
Labels
feature Is an improvement or enhancement help wanted Open to be worked on
Milestone

Comments

@jeremyjordan
Copy link
Contributor

🚀 Feature

In the training loop, we should catch KeyboardInterrupt exceptions and enter a graceful termination (ie. run on_training_end, print profiler report, etc).

Motivation

Sometimes I'll train a model and just let it run until something interesting happens or my loss has converged. Exiting via "Ctrl + C" can be easier than waiting for "EarlyStopping" to trigger in some cases. However, I may still want certain things to occur (eg. printing out the profiler summary) after stopping training.

Salesforce's AWD-LSTM has an example of this feature implemented here.

Pitch

Figure out what actions we want to run after a KeyboardInterrupt. Then adjust the training loop to catch this exception and ensure the aforementioned actions still run afterwards.

@jeremyjordan jeremyjordan added feature Is an improvement or enhancement help wanted Open to be worked on labels Feb 6, 2020
@williamFalcon
Copy link
Contributor

awesome, let's do it

@williamFalcon
Copy link
Contributor

@jeremyjordan can we get it into this release? :)

@jeremyjordan
Copy link
Contributor Author

when’s the release? planning to get to it this weekend

@williamFalcon
Copy link
Contributor

feb 21

@jeremyjordan
Copy link
Contributor Author

sure, shouldn't be a problem then :)

@lezwon
Copy link
Contributor

lezwon commented Mar 7, 2020

Hey guys, I am currently 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 something was wrong. However, If I do that, the notebook shuts down. Is there any way to make this feature optional? I don't want my notebook shutting down after a keyboard interrupt, only after successful training completion.

@jeremyjordan
Copy link
Contributor Author

@lezwon Hmm yeah, that's not ideal. Do you mind creating a new issue (you can reference this one) with the problem and I can draft up a PR to address it?

@Borda Borda changed the title support graceful training cleanup after KeyboardInterrupt support graceful training cleanup after Keyboard Interrupt Mar 8, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Is an improvement or enhancement help wanted Open to be worked on
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants