-
Notifications
You must be signed in to change notification settings - Fork 4.2k
Add Tutorial of QAT with X86InductorQuantizer #2717
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
Add Tutorial of QAT with X86InductorQuantizer #2717
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/2717
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 9f307f7 with merge base d9e986f ( This comment was automatically generated by Dr. CI and updates every 15 minutes. |
cc @jgong5 @jerryzh168 @svekars please help to take a look of this PR. |
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.
Thank you, @leslie-fang-intel! Just a couple editorial suggestions.
should we incorporate this into the PTQ tutorial to reduce the number of tutorials? Maybe we should do the same for XNNPACKQuantizer as well, cc @andrewor14 |
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.
Hi @leslie-fang-intel, thanks for working on this. I agree with @jerryzh168 that we should merge this with the X86Inductor PTQ tutorial. What you're adding here seems very similar to the existing PT2 export QAT tutorial except for maybe these 2 lines:
so I feel it's not worth making a brand new tutorial just for this use case. What do you think? |
@jerryzh168 @andrewor14 Thanks for the comment. Merge the |
I'm good either way, if you have bandwidth you can merge these two in one PR and close the one we don't need to merge. But also happy with the rebase plan. |
@@ -154,6 +176,7 @@ Finally, we will convert the calibrated Model to a quantized Model. ``convert_pt | |||
:: | |||
|
|||
converted_model = convert_pt2e(prepared_model) | |||
torch.ao.quantization.move_exported_model_to_eval(converted_model) |
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.
is this needed for both PTQ and QAT?
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 feel we could also have a separate section for QAT, like what we did in https://pytorch.org/tutorials/advanced/static_quantization_tutorial.html#quantization-aware-training
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.
Thanks for the comment. Yean, I think it will be much clearer for reader. Move the QAT into a separate section. Please kindly help to take a look again @jerryzh168.
Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
0eb4ae7
to
16aa287
Compare
Hi @svekars @jerryzh168, I have rebased to fix the conflict. Please kindly help to take a look again. |
* Add QAT Tutorial --------- Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
* Add QAT Tutorial --------- Co-authored-by: Svetlana Karslioglu <svekars@meta.com>
Description
This diff adds the new tutorial of
PyTorch 2 Export Quantization-Aware Training (QAT) with X86 Backend through Inductor
.Checklist