-
Notifications
You must be signed in to change notification settings - Fork 26.3k
Fix condition for weights_only unpickler for DTensor #140740
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 condition for weights_only unpickler for DTensor #140740
Conversation
[ghstack-poisoned]
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/140740
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 9e9bdbc with merge base b379a28 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
@mikaylagawarecki has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
The additions should not have been gated on `if hasattr(torch.distributed, "dtensor")` With pytorch built with USE_DISTRIBUTED=1 ``` >>> import torch >>> hasattr(torch.distributed, "dtensor") False ``` Differential Revision: [D65961690](https://our.internmc.facebook.com/intern/diff/D65961690) [ghstack-poisoned]
The additions should not have been gated on `if hasattr(torch.distributed, "dtensor")` With pytorch built with USE_DISTRIBUTED=1 ``` >>> import torch >>> hasattr(torch.distributed, "dtensor") False ``` Differential Revision: [D65961690](https://our.internmc.facebook.com/intern/diff/D65961690) cc H-Huang awgu kwen2501 wanchaol fegin fduwjj wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
|
@mikaylagawarecki has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Same as #140739 but for DTensor (move safe globals for DTensor to `torch.distributed.tensor.__init__` and update error message to let user know `torch.distributed.tensor` must be imported to load DTensor) Differential Revision: [D65961690](https://our.internmc.facebook.com/intern/diff/D65961690) cc H-Huang awgu kwen2501 wanchaol fegin fduwjj wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
Same as #140739 but for DTensor (move safe globals for DTensor to `torch.distributed.tensor.__init__` and update error message to let user know `torch.distributed.tensor` must be imported to load DTensor) Differential Revision: [D65961690](https://our.internmc.facebook.com/intern/diff/D65961690) cc H-Huang awgu kwen2501 wanchaol fegin fduwjj wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
Same as #140739 but for DTensor (move safe globals for DTensor to `torch.distributed.tensor.__init__` and update error message to let user know `torch.distributed.tensor` must be imported to load DTensor) Differential Revision: [D65961690](https://our.internmc.facebook.com/intern/diff/D65961690) cc H-Huang awgu kwen2501 wanchaol fegin fduwjj wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
Same as #140739 but for DTensor (move safe globals for DTensor to `torch.distributed.tensor.__init__` and update error message to let user know `torch.distributed.tensor` must be imported to load DTensor) Differential Revision: [D65961690](https://our.internmc.facebook.com/intern/diff/D65961690) cc H-Huang awgu kwen2501 wanchaol fegin fduwjj wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
Same as #140739 but for DTensor (move safe globals for DTensor to `torch.distributed.tensor.__init__` and update error message to let user know `torch.distributed.tensor` must be imported to load DTensor) Differential Revision: [D65961690](https://our.internmc.facebook.com/intern/diff/D65961690) cc H-Huang awgu kwen2501 wanchaol fegin fduwjj wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
Same as #140739 but for DTensor (move safe globals for DTensor to `torch.distributed.tensor.__init__` and update error message to let user know `torch.distributed.tensor` must be imported to load DTensor) Differential Revision: [D65961690](https://our.internmc.facebook.com/intern/diff/D65961690) cc H-Huang awgu kwen2501 wanchaol fegin fduwjj wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
Same as #140739 but for DTensor (move safe globals for DTensor to `torch.distributed.tensor.__init__` and update error message to let user know `torch.distributed.tensor` must be imported to load DTensor) Differential Revision: [D65961690](https://our.internmc.facebook.com/intern/diff/D65961690) cc H-Huang awgu kwen2501 wanchaol fegin fduwjj wz337 wconstab d4l3k c-p-i-o [ghstack-poisoned]
|
Thanks for helping to fix it! |
Pull Request resolved: #140850 Approved by: https://github.com/malfet ghstack dependencies: #140739, #140740
…ually (#141300) #140739 and #140740 made it such that `get_safe_globals` no longer return an empty List by default This caused some tests that check the content of `get_safe_globals` to fail, in particular when run individually (they didn't fail in test suite as other tests ran before them called `clear_safe_globals`) but will fail when tests are run individually [T208186010](https://www.internalfb.com/intern/tasks/?t=208186010) test_safe_globals_for_weights_only test_safe_globals_context_manager_weights_only This PR fixes that and also makes most tests calling `clear_safe_globals` use the `safe_globals` context manager rather than try: finally Pull Request resolved: #141300 Approved by: https://github.com/awgu
Same as pytorch#140739 but for DTensor (move safe globals for DTensor to `torch.distributed.tensor.__init__` and update error message to let user know `torch.distributed.tensor` must be imported to load DTensor) Differential Revision: [D65961690](https://our.internmc.facebook.com/intern/diff/D65961690) Pull Request resolved: pytorch#140740 Approved by: https://github.com/malfet ghstack dependencies: pytorch#140739
Pull Request resolved: pytorch#140850 Approved by: https://github.com/malfet ghstack dependencies: pytorch#140739, pytorch#140740
…ually (pytorch#141300) pytorch#140739 and pytorch#140740 made it such that `get_safe_globals` no longer return an empty List by default This caused some tests that check the content of `get_safe_globals` to fail, in particular when run individually (they didn't fail in test suite as other tests ran before them called `clear_safe_globals`) but will fail when tests are run individually [T208186010](https://www.internalfb.com/intern/tasks/?t=208186010) test_safe_globals_for_weights_only test_safe_globals_context_manager_weights_only This PR fixes that and also makes most tests calling `clear_safe_globals` use the `safe_globals` context manager rather than try: finally Pull Request resolved: pytorch#141300 Approved by: https://github.com/awgu
Same as pytorch#140739 but for DTensor (move safe globals for DTensor to `torch.distributed.tensor.__init__` and update error message to let user know `torch.distributed.tensor` must be imported to load DTensor) Differential Revision: [D65961690](https://our.internmc.facebook.com/intern/diff/D65961690) Pull Request resolved: pytorch#140740 Approved by: https://github.com/malfet ghstack dependencies: pytorch#140739
Pull Request resolved: pytorch#140850 Approved by: https://github.com/malfet ghstack dependencies: pytorch#140739, pytorch#140740
…ually (pytorch#141300) pytorch#140739 and pytorch#140740 made it such that `get_safe_globals` no longer return an empty List by default This caused some tests that check the content of `get_safe_globals` to fail, in particular when run individually (they didn't fail in test suite as other tests ran before them called `clear_safe_globals`) but will fail when tests are run individually [T208186010](https://www.internalfb.com/intern/tasks/?t=208186010) test_safe_globals_for_weights_only test_safe_globals_context_manager_weights_only This PR fixes that and also makes most tests calling `clear_safe_globals` use the `safe_globals` context manager rather than try: finally Pull Request resolved: pytorch#141300 Approved by: https://github.com/awgu
Same as pytorch#140739 but for DTensor (move safe globals for DTensor to `torch.distributed.tensor.__init__` and update error message to let user know `torch.distributed.tensor` must be imported to load DTensor) Differential Revision: [D65961690](https://our.internmc.facebook.com/intern/diff/D65961690) Pull Request resolved: pytorch#140740 Approved by: https://github.com/malfet ghstack dependencies: pytorch#140739
Pull Request resolved: pytorch#140850 Approved by: https://github.com/malfet ghstack dependencies: pytorch#140739, pytorch#140740
Same as #140739 but for DTensor (move safe globals for DTensor to
torch.distributed.tensor.__init__and update error message to let user knowtorch.distributed.tensormust be imported to load DTensor)Stack from ghstack (oldest at bottom):
Differential Revision: D65961690
cc @H-Huang @awgu @kwen2501 @wanchaol @fegin @fduwjj @wz337 @wconstab @d4l3k @c-p-i-o