Skip to content

Conversation

navsud
Copy link
Contributor

@navsud navsud commented Oct 9, 2025

Summary: Learnable Fake Quantize is a popular technique used especially for low-precision QAT. This was available in fx quantization at https://github.com/pytorch/pytorch/blob/main/torch/ao/quantization/_learnable_fake_quantize.py#L10?, but not in pt2e quantization flow. This change adds learnable fake quantize in pt2e, with some changes, especially related to how channel wise quantization works.

Differential Revision: D83542550

Copy link

pytorch-bot bot commented Oct 9, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/ao/3135

Note: Links to docs will display an error until the docs builds have been completed.

❌ 4 New Failures

As of commit dd004b2 with merge base a5a8fe2 (image):

NEW FAILURES - The following jobs have failed:

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

@meta-cla meta-cla 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 Oct 9, 2025
Copy link

meta-codesync bot commented Oct 9, 2025

@navsud has exported this pull request. If you are a Meta employee, you can view the originating Diff in D83542550.

@navsud navsud added the topic: new feature Use this tag if this PR adds a new feature label Oct 9, 2025
@jerryzh168 jerryzh168 requested a review from andrewor14 October 9, 2025 03:32
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you correct the name to fake_quantizer?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jerryzh168
I'm trying to be consistent with FakeQuantize() class at: https://github.com/pytorch/ao/blob/main/torchao/quantization/pt2e/fake_quantize.py.
I'm ok to change the file name: learnable_fake_quantize.py to learnable_fake_quantizer.py and the class name from LearnableFakeQuantize() to LearnableFakeQuantizer() if that is what you meant.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is for pt2e flow, so I feel the name FakeQuantize is more consistent with the other classes?

Copy link
Contributor

@jerryzh168 jerryzh168 Oct 9, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FakeQuantize is the wrong name I think since it's a verb not noun, it's not consistent with Observer which is a noun. We can correct, and deprecate FakeQuantize itself as we add new things.

But it's OK to do this separately as well

navsud added a commit to navsud/ao that referenced this pull request Oct 9, 2025
Summary:

Learnable Fake Quantize is a popular technique used especially for low-precision QAT. This was available in fx quantization at https://github.com/pytorch/pytorch/blob/main/torch/ao/quantization/_learnable_fake_quantize.py#L10?, but not in pt2e quantization flow. This change adds learnable fake quantize in pt2e, with some changes, especially related to how channel wise quantization works.

Differential Revision: D83542550
navsud added a commit to navsud/ao that referenced this pull request Oct 9, 2025
Summary:

Learnable Fake Quantize is a popular technique used especially for low-precision QAT. This was available in fx quantization at https://github.com/pytorch/pytorch/blob/main/torch/ao/quantization/_learnable_fake_quantize.py#L10?, but not in pt2e quantization flow. This change adds learnable fake quantize in pt2e, with some changes, especially related to how channel wise quantization works.

Differential Revision: D83542550
Copy link
Contributor

@andrewor14 andrewor14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks great, thanks for addressing the comments. Once you fix the tests we can go ahead and merge this

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah this is for pt2e flow, so I feel the name FakeQuantize is more consistent with the other classes?

navsud added a commit to navsud/ao that referenced this pull request Oct 9, 2025
Summary:

Learnable Fake Quantize is a popular technique used especially for low-precision QAT. This was available in fx quantization at https://github.com/pytorch/pytorch/blob/main/torch/ao/quantization/_learnable_fake_quantize.py#L10?, but not in pt2e quantization flow. This change adds learnable fake quantize in pt2e, with some changes, especially related to how channel wise quantization works.

Reviewed By: andrewor14

Differential Revision: D83542550
Summary:

Learnable Fake Quantize is a popular technique used especially for low-precision QAT. This was available in fx quantization at https://github.com/pytorch/pytorch/blob/main/torch/ao/quantization/_learnable_fake_quantize.py#L10?, but not in pt2e quantization flow. This change adds learnable fake quantize in pt2e, with some changes, especially related to how channel wise quantization works.

Reviewed By: andrewor14

Differential Revision: D83542550
@meta-codesync meta-codesync bot merged commit 233cfc1 into pytorch:main Oct 9, 2025
15 of 20 checks passed
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. fb-exported meta-exported 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