Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clarify requirements for Trainer.fit(ckpt_path="last") #19066

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/source-pytorch/common/evaluation_intermediate.rst
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,10 @@ To run the test set after training completes, use this method.
# run full training
trainer.fit(model)

# (1) load the best checkpoint automatically (lightning tracks this for you)
# (1) load the best checkpoint automatically (lightning tracks this for you during .fit())
trainer.test(ckpt_path="best")

# (2) load the last available checkpoint
# (2) load the last available checkpoint (only works if `ModelCheckpoint(save_last=True)`)
trainer.test(ckpt_path="last")

# (3) test using a specific checkpoint
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def _parse_ckpt_path(
# not an error so it can be set and forget before the first `fit` run
rank_zero_warn(
f'.{fn}(ckpt_path="last") is set, but there is no last checkpoint available.'
" No checkpoint will be loaded."
" No checkpoint will be loaded. HINT: Set `ModelCheckpoint(..., save_last=True)`."
)
return None
ckpt_path = max(candidates_ts, key=candidates_ts.get) # type: ignore[arg-type]
Expand Down
Loading