Feature request - load best checkpoint
Open
Nobody has claimed this yet.
enhancement
- Dominant language
- Python
- Stars
- 10.8k
- Forks
- 989
- Avg merge
- 6h 29m
- Merged PRs (30d)
- 85
Description
Currently there is a function TrainableModel.delete_checkpoints(best_checkpoint_metric) which removes all checkpoints except the best and the latest.
Unfortunately, there is no straight-forward way to load the weights according to the best checkpoint.
It would be nice if such function existed.
Example signature:
class TrainableModel:
def load_checkpoint(which: int | Literal["best"] | Literal["latest"] = "latest", best_checkpoint_metric: str = "val/reward"):
"""
Args:
which (int | Literal["best"] | Literal["latest"]) - The type of checkpoint to load.
- "best" loads the best checkpoint according to the `best_checkpoint_metric"
- "latest" loads the latest checkpoint available
- integer value determines the step number of the checkpoint.
best_checkpoint_metric (str) - the name of the metric determining which checkpoint is best.
"""
...
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating TrainableModel.delete_checkpoints and the checkpoint-loading entry points. Trace how checkpoint steps and best_checkpoint_metric are recorded, then verify that loading supports the requested best, latest, and integer-step choices with the documented default metric.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100