-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Fix static_quantization_tutorial error in qat_model #2661
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/tutorials/2661
Note: Links to docs will display an error until the docs builds have been completed. ✅ No FailuresAs of commit 1726ae9 with merge base 66eaf6a (): This comment was automatically generated by Dr. CI and updates every 15 minutes. |
eval mode fuse_model might do different things comparing to train mode fuse_model, could you print the result after fuse_model before and after you add this change? |
It throws an error stating fusion is only for eval:
|
I see, thanks, I think you should do:
instead. see: https://github.com/pytorch/vision/blob/main/torchvision/models/quantization/mobilenetv2.py#L58 |
We need to use the qat variant of the fuse_modules method. After this fix, the tutorial runs to completion on a linux x86 system. Fixes pytorch#1269 Signed-off-by: BJ Hargrave <hargrave@us.ibm.com>
83a0238
to
060dc6a
Compare
I updated the tutorial as suggested. |
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!
The model must be in eval mode to fuse and in train mode to prepare_qat. After this fix, the tutorial runs to completion on a linux x86 system.
Fixes #1269
cc @jerryzh168 @jianyuh @sekyondaMeta @svekars @carljparker @NicolasHug @kit1980 @subramen