-
Notifications
You must be signed in to change notification settings - Fork 25.7k
Fix warning when pickle.load torch.Storage #130246
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix warning when pickle.load torch.Storage #130246
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/130246
Note: Links to docs will display an error until the docs builds have been completed. ❗ 1 Active SEVsThere are 1 currently active SEVs. If your PR is affected, please view them below: ✅ No FailuresAs of commit ec4dc8a with merge base ce4d951 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
| mod.eval() | ||
| self.assertTrue(len(w) == 0) | ||
|
|
||
| def test_parameterlistdict_pickle(self): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reverting changes to this test in #129239 whoops :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would like to ask why I couldn't find the test_nn.py file in my environment? I have already modified the storage.py file, but I still receive this warning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good!
|
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
|
From the discussion re FutureWarnings on #130658 in triage review yesterday, it was discussed that resolving those should be milestoned for 2.4.1 This PR fixed another related weights_only warning when |
Fixes pytorch#130242 Since `torch.save` does not use pickle for storages, the `torch.load` in `_load_from_bytes` should not ever be called when `torch.load`-ing a checkpoint. Setting weights_only=False explicitly in `_load_from_bytes` to avoid the weights_only warning when using the pickle module Pull Request resolved: pytorch#130246 Approved by: https://github.com/albanD
|
@pytorchbot cherry-pick --onto release/2.4 -c critical --fixes #130242 |
Fixes #130242 Since `torch.save` does not use pickle for storages, the `torch.load` in `_load_from_bytes` should not ever be called when `torch.load`-ing a checkpoint. Setting weights_only=False explicitly in `_load_from_bytes` to avoid the weights_only warning when using the pickle module Pull Request resolved: #130246 Approved by: https://github.com/albanD (cherry picked from commit dfd1d19)
Cherry picking #130246The cherry pick PR is at #133597 and it is linked with issue #130242. The following tracker issues are updated: Details for Dev Infra teamRaised by workflow job |
Fix warning when pickle.load torch.Storage (#130246) Fixes #130242 Since `torch.save` does not use pickle for storages, the `torch.load` in `_load_from_bytes` should not ever be called when `torch.load`-ing a checkpoint. Setting weights_only=False explicitly in `_load_from_bytes` to avoid the weights_only warning when using the pickle module Pull Request resolved: #130246 Approved by: https://github.com/albanD (cherry picked from commit dfd1d19) Co-authored-by: Mikayla Gawarecki <mikaylagawarecki@gmail.com>
Fixes #130242
Since
torch.savedoes not use pickle for storages, thetorch.loadin_load_from_bytesshould not ever be called whentorch.load-ing a checkpoint. Setting weights_only=False explicitly in_load_from_bytesto avoid the weights_only warning when using the pickle moduleStack from ghstack (oldest at bottom):