-
Notifications
You must be signed in to change notification settings - Fork 352
Optional: use inv_scale for WeightTensorWithLinearActivationScaleMetadata #3176
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
base: main
Are you sure you want to change the base?
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/3176
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit c7e242c with merge base ff16308 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
|
Hi @jerryzh168 Can you please review this PR? Thanks. |
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.
we are deprecating these utils though to_weight_tensor_with_linear_activation_scale_metadata
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.
we are deprecating these utils though to_weight_tensor_with_linear_activation_scale_metadata
Hi @jerryzh168 Thanks for reviewing. This PR modifies the ao/torchao/quantization/linear_activation_scale.py Lines 118 to 120 in 7e68d5e
And this PR adds a new argument use_inv_scale to WeightTensorWithLinearActivationScaleMetadata.from_float: ao/torchao/quantization/linear_activation_scale.py Lines 73 to 78 in 7e68d5e
and modifies the implementation of the WeightTensorWithLinearActivationScaleMetadata.
Can you please review again? Thanks. |
Summary
Use inv_scale on CPU to avoid division at runtime to improve performance. Used for SmoothQuant.
Test plan
pytest -sv test/prototype/test_smoothquant.py