-
Notifications
You must be signed in to change notification settings - Fork 23k
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
[quant][pt2] Fix QAT convert for mobilenetv2 #104110
Conversation
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/104110
Note: Links to docs will display an error until the docs builds have been completed. ❌ 1 New FailureAs of commit e759384: This comment was automatically generated by Dr. CI and updates every 15 minutes. |
This pull request was exported from Phabricator. Differential Revision: D46750343 |
96a5d29
to
c0d8a58
Compare
This pull request was exported from Phabricator. Differential Revision: D46750343 |
This pull request was exported from Phabricator. Differential Revision: D46750343 |
c0d8a58
to
386e0d6
Compare
386e0d6
to
1320255
Compare
This pull request was exported from Phabricator. Differential Revision: D46750343 |
1320255
to
53e5d32
Compare
This pull request was exported from Phabricator. Differential Revision: D46750343 |
53e5d32
to
4712d6f
Compare
This pull request was exported from Phabricator. Differential Revision: D46750343 |
4712d6f
to
5fc046d
Compare
This pull request was exported from Phabricator. Differential Revision: D46750343 |
5fc046d
to
1229942
Compare
This pull request was exported from Phabricator. Differential Revision: D46750343 |
Summary: Pull Request resolved: pytorch#104110 QAT convert for mobilenetv2 was previously not working because we incorrectly applied dropout during eval as well as training. This is because, for exported models, model.eval() does not change the behavior of dropout, unlike models with torch ops. This commit simulates the effects of model.eval() for exported models as well by replacing the aten dropout pattern before eval. As of this commit, end-to-end QAT numerics now match for mobilenetv2 between FX and PT2. Test Plan: python test/test_quantization.py TestQuantizePT2EModels.test_qat_mobilenet_v2 Reviewed By: jerryzh168 Differential Revision: D46750343 fbshipit-source-id: 38a1a027ed8680edc022a4c5a4015c3b5c811438
1229942
to
c489280
Compare
This pull request was exported from Phabricator. Differential Revision: D46750343 |
c489280
to
a42884f
Compare
This pull request was exported from Phabricator. Differential Revision: D46750343 |
1 similar comment
This pull request was exported from Phabricator. Differential Revision: D46750343 |
a42884f
to
a9879f7
Compare
a9879f7
to
7ad12b1
Compare
This pull request was exported from Phabricator. Differential Revision: D46750343 |
Summary: Pull Request resolved: pytorch#104110 QAT convert for mobilenetv2 was previously not working because we incorrectly applied dropout during eval as well as training. This is because, for exported models, model.eval() does not change the behavior of dropout, unlike models with torch ops. This commit simulates the effects of model.eval() for exported models as well by replacing the aten dropout pattern before eval. As of this commit, end-to-end QAT numerics now match for mobilenetv2 between FX and PT2. Test Plan: python test/test_quantization.py TestQuantizePT2EModels.test_qat_mobilenet_v2 Reviewed By: jerryzh168 Differential Revision: D46750343 fbshipit-source-id: dcf508c0167c1c362410ca860824299c4b35bab6
7ad12b1
to
e759384
Compare
This pull request was exported from Phabricator. Differential Revision: D46750343 |
@pytorchbot merge |
Merge startedYour change will be merged once all checks pass (ETA 0-4 Hours). Learn more about merging in the wiki. Questions? Feedback? Please reach out to the PyTorch DevX Team |
Summary:
QAT convert for mobilenetv2 was previously not working
because we incorrectly applied dropout during eval as well as
training. This is because, for exported models, model.eval() does
not change the behavior of dropout, unlike models with torch ops.
This commit simulates the effects of model.eval() for exported
models as well by replacing the aten dropout pattern before eval.
As of this commit, end-to-end QAT numerics now match for
mobilenetv2 between FX and PT2.
Test Plan: python test/test_quantization.py TestQuantizePT2EModels.test_qat_mobilenet_v2
Differential Revision: D46750343
cc @voznesenskym @penguinwu @anijain2305 @EikanWang @jgong5 @Guobing-Chen @XiaobingSuper @zhuhaozhe @blzheng @Xia-Weiwen @wenzhe-nrv @jiayisunx @ipiszy @chenyang78