Skip to content

Commit 42bbac1

Browse files
committed
add description to on exception hook in model checkpoint
1 parent d78ea3e commit 42bbac1

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/lightning/pytorch/callbacks/model_checkpoint.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -344,6 +344,7 @@ def on_validation_end(self, trainer: "pl.Trainer", pl_module: "pl.LightningModul
344344

345345
@override
346346
def on_exception(self, trainer: "pl.Trainer", pl_module: "pl.LightningModule", exception: Exception) -> None:
347+
"""Save a checkpoint when an exception is raised."""
347348
if self._should_save_on_exception(trainer):
348349
monitor_candidates = self._monitor_candidates(trainer)
349350
filepath = self.format_checkpoint_name(metrics=monitor_candidates, prefix=self.CHECKPOINT_EXCEPTION_PREFIX)

0 commit comments

Comments
 (0)