Skip to content

Commit 2ca6dab

Browse files
committed
also print exception when saving checkpoint
1 parent c4b8063 commit 2ca6dab

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/lightning/pytorch/callbacks/model_checkpoint.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -350,7 +350,10 @@ def on_exception(self, trainer: "pl.Trainer", pl_module: "pl.LightningModule", e
350350
filepath = self.format_checkpoint_name(metrics=monitor_candidates, prefix=self.CHECKPOINT_EXCEPTION_PREFIX)
351351
self._save_checkpoint(trainer, filepath)
352352
self._save_last_checkpoint(trainer, monitor_candidates)
353-
rank_zero_info(f"An exception was raised saved checkpoint to {filepath}")
353+
rank_zero_info(
354+
f"An {type(exception).__name__} was raised with message: \
355+
{str(exception)}, saved checkpoint to {filepath}"
356+
)
354357

355358
@override
356359
def state_dict(self) -> dict[str, Any]:

0 commit comments

Comments
 (0)