Keras fit() lacks native timeout parameter
0 reputation · 23 Oct 2024, 14:07 UTC
The Keras fit() method provides no built-in timeout mechanism, requiring users to add custom callbacks to stop training after a set duration.
Current callbacks such as EarlyStopping monitor validation loss but cannot enforce time-based stopping, and manual KeyboardInterrupt handling may leave the model in an inconsistent state if weights are not checkpointed before interruption.
How can a reliable timeout be implemented that works across Keras 2.x and 3.x versions and the TensorFlow, JAX, or PyTorch backends, and what safeguards are needed to ensure model weights are saved and resources released when the timeout triggers?