Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Fix: Explicitly set weights_only=True in torch.load to handle FutureWarning (#949) #950

Merged
merged 1 commit into from
Dec 11, 2024

Conversation

NripeshN
Copy link
Contributor

@NripeshN NripeshN commented Dec 1, 2024

Description

This PR addresses closes #949 by modifying the default_deserialize_torch_model function in PyTorchShim. The change explicitly sets the weights_only=True flag when calling torch.load. This resolves the FutureWarning regarding potential security issues with implicit pickle module usage and aligns with future PyTorch updates where weights_only will default to True.

Types of change

Bug Fix

Checklist

  • I confirm that I have the right to submit this contribution under the project's MIT license.
  • I ran the tests, and all new and existing tests passed.
  • My changes don't require a change to the documentation, or if they do, I've added all required information.

@NripeshN NripeshN changed the title Fix: Explicitly set weights_only=True in torch.load to handle FutureWarning (#949) Fix: Explicitly set weights_only=True in torch.load to handle FutureWarning (#949) Dec 1, 2024
@honnibal honnibal merged commit 256e403 into explosion:main Dec 11, 2024
@NripeshN NripeshN deleted the weight-pytorch-fix branch December 12, 2024 17:13
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Update torch.load usage to handle weights_only flag
2 participants