Add module swap quantization API from Quanty#1886
Merged
Merged
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/1886
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit 5001ba6 with merge base 8c81863 ( NEW FAILURE - The following job has failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
bf0a842 to
715d6cd
Compare
vkuzo
reviewed
Mar 14, 2025
| @@ -0,0 +1,56 @@ | |||
| import copy | |||
Contributor
There was a problem hiding this comment.
IMO these tests should be in test/prototype/quantization/module_swap
31bd9f1 to
38b1361
Compare
vkuzo
approved these changes
Mar 14, 2025
vkuzo
left a comment
Contributor
There was a problem hiding this comment.
a short README.md of prototype/module_swap_quantization would be nice as well
2ed4d2d to
16022cf
Compare
**Summary:** This commit adds a module-swap-based PTQ API from Quanty, including: - Quantized linear and embedding modules - `IntQuantizer` to specify how to quantize weights and activations - `CodeBookQuantizer` as an alternative to IntQuantizer - Implementation of K-means to be used for codebook quantization - Range setting and data getter utility These new APIs will complement our existing `quantize_` API, which is primarily used for tensor-subclass-based quantization today (though it can also support module swaps). All APIs introduced in this commit are under prototype and highly subject to change. In particular, we plan to delete `quantize_module_swap` and `QuantizationRecipe`, and instead integrate this flow with the `quantize_` API by creating a new `AOBaseConfig`. All code is migrated from Quanty and written by @TiRune. **Test Plan:** python test/quantization/module_swap/test_*
16022cf to
5001ba6
Compare
Contributor
Author
|
Thanks, added the README. Merging this! |
liangel-02
pushed a commit
that referenced
this pull request
Aug 25, 2025
**Summary:** This commit adds a module-swap-based PTQ API from Quanty, including: - Quantized linear and embedding modules - `IntQuantizer` to specify how to quantize weights and activations - `CodeBookQuantizer` as an alternative to IntQuantizer - Implementation of K-means to be used for codebook quantization - Range setting and data getter utility These new APIs will complement our existing `quantize_` API, which is primarily used for tensor-subclass-based quantization today (though it can also support module swaps). All APIs introduced in this commit are under prototype and highly subject to change. In particular, we plan to delete `quantize_module_swap` and `QuantizationRecipe`, and instead integrate this flow with the `quantize_` API by creating a new `AOBaseConfig`. All code is migrated from Quanty and written by @TiRune. **Test Plan:** python test/quantization/module_swap/test_*
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary: This commit adds a module-swap-based PTQ API from Quanty, including:
IntQuantizerto specify how to quantize weights and activationsCodeBookQuantizeras an alternative to IntQuantizerThese new APIs will complement our existing
quantize_API, which is primarily used for tensor-subclass-based quantization today (though it can also support module swaps). All APIs introduced in this commit are under prototype and highly subject to change. In particular, we plan to deletequantize_module_swapandQuantizationRecipe, and instead integrate this flow with thequantize_API by creating a newAOBaseConfig.All code is migrated from Quanty and written by @TiRune.
Test Plan:
python test/quantization/module_swap/test_*