Expose weights_only
option for loading checkpoints
#20058
Labels
Milestone
weights_only
option for loading checkpoints
#20058
Description & Motivation
PyTorch will default the
torch.load(weights_only=)
option to True in the future, and started emitting FutureWarning in 2.4. Since Lightning allows storing all kinds of data into the checkpoint (mainly through save_hyperparameters() and the on_save_checkpoint hooks), so far we have to explicitly setweights_only=False
internally to be able to load checkpoints. But we could also expose this argument as a flag for the user to choose how strict they want to be when loading checkpoints.Pitch
In Fabric.load, expose weights_only.
In PyTorch Lightning, either add
fit(..., load_weights_only=...)
or add an attribute to the LightningModule (similar to how we handle strict_loading).Alternatives
No response
Additional context
No response
cc @Borda @awaelchli
The text was updated successfully, but these errors were encountered: