-
Notifications
You must be signed in to change notification settings - Fork 351
Add exportable coreml codebook quantization op #2443
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/2443
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 8fb10b2 with merge base 5a50667 ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
torchao/prototype/quantization/coreml_codebook/codebook_quantized_tensor.py
Show resolved
Hide resolved
torchao/prototype/quantization/coreml_codebook/codebook_quantized_tensor.py
Outdated
Show resolved
Hide resolved
torchao/prototype/quantization/coreml_codebook/codebook_quantized_tensor.py
Show resolved
Hide resolved
| codes = codes.to(torch.int32) | ||
| return dequantize_codebook( | ||
| codes, | ||
| self.codebook, |
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.
Should we have a granularity?
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'll use block_size for now, it can be extended to other granularities
Summary: Added CoreML codebook quant (Palettization): https://apple.github.io/coremltools/docs-guides/source/opt-palettization-overview.html#palettization-overview * supports group_size `per_grouped_channel` * doesn't support vector quantization yet, but will be easy to turn on if needed * ops added: choose_qparams_and_quantize_codebook, dequantize_codebook * also enabled support for export, these two ops will be preserved after exporta * Added CodebookWeightOnlyConfig(dtype, group_size) that can be used with quantize_ to quantize the Tensor Test Plan: python test/prototype/test_coreml_codebook.py Reviewers: Subscribers: Tasks: Tags:
Summary: Added CoreML codebook quant (Palettization): https://apple.github.io/coremltools/docs-guides/source/opt-palettization-overview.html#palettization-overview * supports group_size `per_grouped_channel` * doesn't support vector quantization yet, but will be easy to turn on if needed * ops added: choose_qparams_and_quantize_codebook, dequantize_codebook * also enabled support for export, these two ops will be preserved after exporta * Added CodebookWeightOnlyConfig(dtype, group_size) that can be used with quantize_ to quantize the Tensor Test Plan: python test/prototype/test_coreml_codebook.py Reviewers: Subscribers: Tasks: Tags:
Summary:
Added CoreML codebook quant (Palettization): https://apple.github.io/coremltools/docs-guides/source/opt-palettization-overview.html#palettization-overview
per_grouped_channelTest Plan:
python test/prototype/test_coreml_codebook.py
Reviewers:
Subscribers:
Tasks:
Tags: