From 2afb8d67fb82d8c77873d30821851cef985ef5eb Mon Sep 17 00:00:00 2001 From: Kathy Fan Date: Fri, 31 Oct 2025 11:53:03 -0700 Subject: [PATCH 1/2] Add verbose logging when ModelCheckpoint callback is done saving a model. This is useful for collecting information on how long model checkpointing takes, together with existing verbose logging on initiating the save. --- keras/src/callbacks/model_checkpoint.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/keras/src/callbacks/model_checkpoint.py b/keras/src/callbacks/model_checkpoint.py index 6143cbfa8fcf..fddcdf2b55f9 100644 --- a/keras/src/callbacks/model_checkpoint.py +++ b/keras/src/callbacks/model_checkpoint.py @@ -283,6 +283,10 @@ def _save_model(self, epoch, batch, logs): self.model.save_weights(filepath, overwrite=True) else: self.model.save(filepath, overwrite=True) + if self.verbose > 0: + io_utils.print_msg( + f"\nEpoch {epoch + 1}: finished saving model to {filepath}" + ) except IsADirectoryError: # h5py 3.x raise IOError( "Please specify a non-directory filepath for " From 6d52d6eada1f9b7f00ea57da8b4fb30a8df20cf1 Mon Sep 17 00:00:00 2001 From: Kathy Fan Date: Fri, 31 Oct 2025 12:08:17 -0700 Subject: [PATCH 2/2] Update model_checkpoint.py Updated formatting for line length. --- keras/src/callbacks/model_checkpoint.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/keras/src/callbacks/model_checkpoint.py b/keras/src/callbacks/model_checkpoint.py index fddcdf2b55f9..a2f7306eff91 100644 --- a/keras/src/callbacks/model_checkpoint.py +++ b/keras/src/callbacks/model_checkpoint.py @@ -285,7 +285,8 @@ def _save_model(self, epoch, batch, logs): self.model.save(filepath, overwrite=True) if self.verbose > 0: io_utils.print_msg( - f"\nEpoch {epoch + 1}: finished saving model to {filepath}" + f"\nEpoch {epoch + 1}: " + f"finished saving model to {filepath}" ) except IsADirectoryError: # h5py 3.x raise IOError(