pytorch / opacus

Training PyTorch models with differential privacy
https://opacus.ai
Apache License 2.0
1.72k stars 345 forks source link

[BC breaking change in torch] `weights_only` default flip for `torch.load` #689

Closed mikaylagawarecki closed 1 day ago

mikaylagawarecki commented 1 week ago

We've flipped the default for the weights_only argument in torch.load to True in pytorch/pytorch, see here for details + documentation and this is coming in torch 2.6.

This is expected to be quite a BC-breaking change, especially if any torch.load calls are not loading state_dicts of plain tensors.

We should make sure that all the torch.load calls in opacus are still working. I see 8 of them that don't have weights_only set.

If opacus already runs CI with pytorch nightly, this should be fine. Otherwise, I'm happy to open a PR to explicitly set weights_only on these, but not sure who to ping for review

EnayatUllah commented 6 days ago

Thanks for the update! Opacus indeed uses CI with pytorch nightly, and I don't see any tests failing, so I think it is fine.

mikaylagawarecki commented 5 days ago

Awesome, thanks we can close this then :)