Add interrupt handlers
See original GitHub issueSince many experiments can take a while and will be running on an environment where the user does not have a lot of control (e.g., a shared cluster), it would be interesting to have interrupt handlers to do something in case the operating system sends a signal to kill the process during the execution of the fit
method. Blocks does this by using the signal
module (which is part of the standard library). That way, you can save the current model state (using pickle, for example) before letting the OS kill your process. Would you be interested in adding something similar to the fit
method in model.py?
Issue Analytics
- State:
- Created 8 years ago
- Reactions:2
- Comments:17 (12 by maintainers)
Top Results From Across the Web
Chapter 7 Interrupt Handlers (Writing Device Drivers)
The suggested method is to add a high-level interrupt handler, which simply triggers a lower-priority software interrupt to handle the device. The driver...
Read more >Using interrupt handlers - IBM
Use an interrupt handler for your operating system to pass data to the CPU. Typically, a static function without parameters is added by...
Read more >Simple interrupt handlers in C - Arm Developer
You can write simple C interrupt handlers by using the __irq function declaration keyword. You can use the __irq keyword both for simple...
Read more >Writing an Interrupt Handler
In any case, a thread specifies which interrupt source it wants to associate with which ISR, using the InterruptAttach() or InterruptAttachEvent() function ...
Read more >4.6. Interrupt Handling - Understanding the Linux Kernel, 3rd ...
The interrupt handler executes several interrupt service routines (ISRs). Each ISR is a function related to a single device sharing the IRQ line....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Any chance this can be reopened? It’s fair that programs not ending on SIGINT are annoying, but I think that somebody that would add this callback explicitly would be very much aware of this fact, and that they’ll just need to send SIGINT twice for the running command to stop immediately.
When iterating with a model running in the cloud, I need to run some clean-up code once training ends, and I often realize that I used too many epochs too late into this process. This would help with these cases.
I’m made a small keras callback that listens for signal (SIGINT by default, using the signal module) and stops the training once this epoch is complete. Would it make sense to open a pull request adding it to callbacks.py? I think it’s a decent solution to allow you to easily interrupt a long training session, and have your code afterwards execute (e.g. save model then exit).
Related, would it be save to call model.save mid-training?