Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jerryzh168
Copy link
Contributor

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:

@pytorch-bot
Copy link

pytorch-bot bot commented Jun 26, 2025

🔗 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 SEVs

There are 1 currently active SEVs. If your PR is affected, please view them below:

✅ No Failures

As of commit 8fb10b2 with merge base 5a50667 (image):
💚 Looks good so far! There are no failures yet. 💚

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jun 26, 2025
codes = codes.to(torch.int32)
return dequantize_codebook(
codes,
self.codebook,
Copy link
Contributor

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?

Copy link
Contributor Author

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:
@jerryzh168 jerryzh168 merged commit 3a5819e into main Jun 27, 2025
21 of 22 checks passed
liangel-02 pushed a commit that referenced this pull request Aug 25, 2025
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:
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. topic: new feature Use this tag if this PR adds a new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants