Skip to content

Commit 7c89a7e

Browse files
authored
implement suggestion
1 parent be4f648 commit 7c89a7e

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

docs/source-pytorch/common/checkpointing_intermediate.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,12 @@ For fine-grained control over checkpointing behavior, use the :class:`~lightning
2222
trainer = Trainer(callbacks=[checkpoint_callback])
2323
trainer.fit(model)
2424
25-
.. note::
26-
You can access the paths of saved checkpoints via the ``checkpoint_callback.best_model_path`` and
27-
``checkpoint_callback.last_model_path`` properties or alternatively ``trainer.checkpoint_callback.best_model_path``
28-
and ``trainer.checkpoint_callback.last_model_path``. These provide the file paths to the best checkpoint
29-
(based on the monitored metric) and the most recently saved checkpoint, respectively.
25+
# Access best and last model checkpoint directly from the callback
26+
print(checkpoint_callback.best_model_path)
27+
print(checkpoint_callback.last_model_path)
28+
# Or via the trainer
29+
print(trainer.checkpoint_callback.best_model_path)
30+
print(trainer.checkpoint_callback.last_model_path)
3031
3132
Any value that has been logged via *self.log* in the LightningModule can be monitored.
3233

0 commit comments

Comments
 (0)