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:
|
return torch.load(cast(IO[bytes], file), map_location=torch.device("cpu")) |
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.
From pytorch 2.6 (next release),
torch.loadwill switch the default forweights_onlyfromFalsetoTrue. I was training models using 2.5 (which defaults toweights_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 nowFalse:fvcore/fvcore/common/checkpoint.py
Line 254 in a491d5b
I think
Checkpointershould allow passing a value forweights_only, either in the constructor or inCheckpointer.load().It's a trivial modification to the code, but it's worth discussing where to introduce the new parameter before proposing a PR.