-
Notifications
You must be signed in to change notification settings - Fork 3.4k
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
Handle KeyboardInterrupt during training #2134
Conversation
Hello @moi90! Thanks for updating this PR. There are currently no PEP 8 issues detected in this Pull Request. Cheers! 🍻 Comment last updated at 2020-06-14 15:23:13 UTC |
This pull request is now in conflict... :( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🤖
Codecov Report
@@ Coverage Diff @@
## master #2134 +/- ##
======================================
Coverage 87% 87%
======================================
Files 68 68
Lines 5180 5187 +7
======================================
+ Hits 4508 4515 +7
Misses 672 672 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great, also the testing is nice.
I propose to change the name to simply on_interrupt for consistency, because for example we have on_test_end
and not on_test_ended
.
@awaelchli Yes, you are right. I will change it accordingly. |
bc859f7
to
ee9a06c
Compare
I think it is about calling something extra on the interrupt, but true that the interruption status is in Trainer... |
This pull request is now in conflict... :( |
@Borda What is your point? Should it be |
ee9a06c
to
090fac8
Compare
I would choose |
@Borda why so? arguments for on_interrupt:
arguments for on_interrupted:
|
on_interrupt to be consistent is my vote. all callbacks are set in the present tense for PL. |
I said I would choose on_interrupted, but do not have any strong preference... |
76f35db
to
47935e9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks great, also the test.
thanks!
Co-authored-by: Adrian Wälchli <[email protected]>
@Borda can you rename to on_keyboard_interrupt? unless this catches any general interrupt? |
@williamFalcon renamed |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Great, thanks for merging! |
Before submitting
What does this PR do?
Fixes #2079 by introducing a
on_interrupted
callback where the cause of the interruption can be examined, e.g. by usingsys.exc_info()
.