-
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
Handling of KeyboardInterrupt #9286
Comments
Thanks for reporting @mibaumgartner I am looking into it! |
What do you mean exactly? I don't see any wrong indentation of the raise statement |
Hi @daniellepintz, thanks for looking into this. |
@mibaumgartner Done in #9260 |
@tchaton @daniellepintz @awaelchli was it intentional that keyboard interrupt didn't re-raise the exception after doing the graceful teardown from #856 ? is that desirable? |
yes certainly, ctrl+c -> graceful shutdown -> exit training without leaving behind a stack trace. that's simply for UX |
Was there concern about ghost background processes in this case? Should this apply to all training types, or only for single device ones? |
@daniellepintz interrupt / exception handling changes are not included in any release are they? |
yes that is correct, all of my recent changes are still unreleased |
Hi @awaelchli, It occurred with several (recent) versions of lightning, including the latest 1.4.5 release. The Issue can be reproduced by raising a Keyboard Interrupt in the Lightning Module (could be a good test :) ): Changes in notebook:
(In the example notebook |
@Borda sorry for the confusion but I don't think #9260 quite resolves this (my bad for saying it did in the PR description) even though we just deprecated current behavior is when there is a KeyboardInterrupt it gracefully exits the current trainer function , not the whole program. but when there is an exception, it raises the exception which exits the whole program. @awaelchli is this intended behavior? |
Yes it will terminate only the current fit function. This graceful shutdown mechanism was introduced before Lightning v1.0, so it is standard behavior for a long time now. To stop program execution, we can raise a SystemExit |
sounds good thanks @awaelchli . @mibaumgartner does this behavior work for you? |
Yes, sounds good 👍 |
🐛 Bug
Same behavior as in #6807
May be caused due to the wrong indentation of the raise statement?
https://github.com/PyTorchLightning/pytorch-lightning/blob/75350938ca646efc0b4bac432ba2d5d4676662bb/pytorch_lightning/trainer/trainer.py#L524
To Reproduce
Run training and raise a Keyboard Interrupt.
Expected behavior
Training should end and KeyboardInterrupt should stop the whole program.
Environment
conda
,pip
, source):torch.__config__.show()
:Additional context
The text was updated successfully, but these errors were encountered: