-
Notifications
You must be signed in to change notification settings - Fork 357
[pt2e] Avoid getting model device once per node #2695
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
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/2695
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit cd57f54 with merge base 183068e ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
4a08e16 to
4040192
Compare
4040192 to
ae3264e
Compare
ae3264e to
12a1c44
Compare
| model.graph, | ||
| "_scale", | ||
| scale, | ||
| scale.device, |
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.
seems like scale could be non-Tensor as well, so here we'd need a device from model instead, same for zero_point
**Summary:** Previously, we call `assert_and_get_unqiue_device` once per node in both prepare and convert. This is expensive and unnecessary since the model device is the same across all nodes, so we should just call this once in the beginning and reuse the same model device across all the nodes. torchao version of pytorch/pytorch#159901 Note: The prepare path is not completely done yet, since we are blocked on the pytorch PR on being merged. It's different from convert since it still calls utility functions from `torch.ao.quantization.fx`. **Test Plan:** ``` python test/quantization/pt2e/test_quantize_pt2e.py ```
12a1c44 to
cd57f54
Compare
Summary: Previously, we call
assert_and_get_unqiue_deviceonce per node in both prepare and convert. This is expensive and unnecessary since the model device is the same across all nodes, so we should just call this once in the beginning and reuse the same model device across all the nodes.torchao version of pytorch/pytorch#159901
Note: The prepare path is not completely done yet, since we are blocked on the pytorch PR on being merged. It's different from convert since it still calls utility functions from
torch.ao.quantization.fx.Test Plan: