facebookresearch / facebookresearch/fvcore
Checkpointer load should specify `weights_only`
- Dominant language
- Python
- Stars
- 2.3k
- Forks
- 236
- PR merge metrics
- No merged PRs in 30d
Description
From pytorch 2.6 (next release), `torch.load` will switch the default for `weights_only` from `False` to `True`. I was training models using 2.5 (which defaults to `weights_only=True`) and when I switched to 2.6 I got an exception when resuming a checkpoint because fvcore doesn't pass that parameter and the the default is now `False`:
https://github.com/facebookresearch/fvcore/blob/a491d5b9a06746f387aca2f1f9c7c7f28e20bef9/fvcore/common/checkpoint.py#L254
I think `Checkpointer` should allow passing a value for `weights_only`, either in the constructor or in `Checkpointer.load()`.
It's a trivial modification to the code, but it's worth discussing where to introduce the new parameter before proposing a PR.
Contributor guide
Research direction
Inspect fvcore/common/checkpoint.py around line 254, where Checkpointer calls torch.load, and review the issue's PyTorch 2.6 behavior. Decide whether weights_only belongs in the constructor or Checkpointer.load(); done means callers can explicitly choose the value and checkpoint loading works with the selected setting.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python, pytorch
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100