Skip to content

Checkpointer load should specify weights_only #154

@baldassarreFe

Description

@baldassarreFe

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions