-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix tensor.__deepcopy__ for lazy device #73197
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
Conversation
Hi @comaniac! Thank you for your pull request and welcome to our community. Action RequiredIn order to merge any pull request (code, docs, etc.), we require contributors to sign our Contributor License Agreement, and we don't seem to have one on file for you. ProcessIn order for us to review and merge your suggested changes, please sign at https://code.facebook.com/cla. If you are contributing on behalf of someone else (eg your employer), the individual CLA may not be sufficient and your employer may need to sign the corporate CLA. Once the CLA is signed, our tooling will perform checks and validations. Afterwards, the pull request will be tagged with If you have received this in error or have any questions, please contact us at cla@fb.com. Thanks! |
CI Flow Status⚛️ CI FlowRuleset - Version:
|
🔗 Helpful links
💊 CI failures summary and remediationsAs of commit 8aedb8e (more details on the Dr. CI page): 💚 💚 Looks good so far! There are no failures yet. 💚 💚 This comment was automatically generated by Dr. CI (expand for details).Please report bugs/suggestions to the (internal) Dr. CI Users group. |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Meta Open Source project. Thanks! |
@wconstab Can you please take a look? |
@comaniac Thanks, this looks right at first glance but can you say how you tested it? I will verify it on our staging branch too. |
- parallel change to that submitted on master by @comaniac
Thanks @wconstab for the review. I basically just did the following. model = torchvision.models.resnet18(num_classes=1000)
model.to(device="lazy")
model.train()
copy.deepcopy(model) # error The above code snippet will trigger the following error. Looks like PyTorch tries to copy a lazy tensor when deep copying a model, although lazy tensor being a model parameter doesn't make any sense to me.
Note 1: I register the Lazy backend by myself. It's pretty much the same way as Torch/XLA. |
@wconstab has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
Summary: A small bug that misses `lazy` in tensor.__deepcopy__, which results in segmentation when deepcopy a lazy model. Pull Request resolved: #73197 Reviewed By: jbschlosser Differential Revision: D34394482 Pulled By: wconstab fbshipit-source-id: c84fdb9b3a827677971fd3477a92679d7dbce3c0
Summary: A small bug that misses `lazy` in tensor.__deepcopy__, which results in segmentation when deepcopy a lazy model. Pull Request resolved: pytorch/pytorch#73197 Reviewed By: jbschlosser Differential Revision: D34394482 Pulled By: wconstab fbshipit-source-id: c84fdb9b3a827677971fd3477a92679d7dbce3c0 (cherry picked from commit c003d150cea969a6595ef8004ea82596fb9431b6)
Summary: A small bug that misses `lazy` in tensor.__deepcopy__, which results in segmentation when deepcopy a lazy model. Pull Request resolved: pytorch/pytorch#73197 Reviewed By: jbschlosser Differential Revision: D34394482 Pulled By: wconstab fbshipit-source-id: c84fdb9b3a827677971fd3477a92679d7dbce3c0 (cherry picked from commit c003d150cea969a6595ef8004ea82596fb9431b6)
A small bug that misses
lazy
in tensor.deepcopy, which results in segmentation when deepcopy a lazy model.