-
Notifications
You must be signed in to change notification settings - Fork 185
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
Move quant ops to utils.py #331
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/331
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 eebb7a2 with merge base 000a0fd (): This comment was automatically generated by Dr. CI and updates every 15 minutes. |
e58d0a6
to
6a9a5f4
Compare
@@ -18,8 +18,8 @@ | |||
fake_quantize_per_channel_group, | |||
fake_quantize_per_token, | |||
) | |||
from torchao.quantization.quant_primitives import get_group_qparams_symmetric | |||
from torchao.quantization.utils import TORCH_VERSION_AFTER_2_4 | |||
from torchao.quantization.utils import get_group_qparams_symmetric |
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'm having trouble figuring out what should be in quant_primitives vs utils
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.
functions in utils are mostly helper functions that calls the quant_primitive ops with some fixed parameters, e.g.
quantize_affine can support: symmetric/asymmetric, per tensor/group/channel etc., int8/int4/int3
helper function in utils can be: int8_symmetric_per_tensor_quant that calls quantize_affine op with fixed settings
Summary: We had a lot of "quant primitive" ops that can be expressed with more primitive ops, so these ops are more of a helper functions now, so we moved them to torchao.quantization.utils we should be able to further deprecate some of the ops after we deprecate subclasses and refactor smoothquant etc. in the future Also moved TORCH_VERSION_AFTER_{2_2/2_3/2_4} from torchao.quantization.utils to torchao.utils Test Plan: python test/integration/test_integration.py python test/quantization/test_quant_api.py python test/quantization/test_quant_primitives.py Reviewers: Subscribers: Tasks: Tags:
Summary: We had a lot of "quant primitive" ops that can be expressed with more primitive ops, so these ops are more of a helper functions now, so we moved them to torchao.quantization.utils we should be able to further deprecate some of the ops after we deprecate subclasses and refactor smoothquant etc. in the future Also moved TORCH_VERSION_AFTER_{2_2/2_3/2_4} from torchao.quantization.utils to torchao.utils Test Plan: python test/integration/test_integration.py python test/quantization/test_quant_api.py python test/quantization/test_quant_primitives.py Reviewers: Subscribers: Tasks: Tags:
Summary:
We had a lot of "quant primitive" ops that can be expressed with more primitive ops, so these ops are more of a helper functions now, so we moved them to torchao.quantization.utils
we should be able to further deprecate some of the ops after we deprecate subclasses and refactor smoothquant etc. in the future
Also moved TORCH_VERSION_AFTER_{2_2/2_3/2_4} from torchao.quantization.utils to torchao.utils
After the move we have the following ops in quant_primitives.py:
Test Plan:
python test/integration/test_integration.py
python test/quantization/test_quant_api.py
python test/quantization/test_quant_primitives.py
python test/quantization/test_qat.py
Reviewers:
Subscribers:
Tasks:
Tags: