-
Notifications
You must be signed in to change notification settings - Fork 741
Qualcomm AI Engine Direct - qat proto #6222
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
Conversation
chunit-quic
commented
Oct 15, 2024
- Add qat proto
- Add Unit test test_qnn_backend_linear_qat
- Test command
🔗 Helpful Links🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/6222
Note: Links to docs will display an error until the docs builds have been completed. ❌ 3 New FailuresAs of commit dd8ace6 with merge base ad0e5e8 ( NEW FAILURES - The following jobs have failed:
This comment was automatically generated by Dr. CI and updates every 15 minutes. |
navsud
left a comment
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.
Would it be possible to also add 16a4w qat config as well, in the same PR or as a follow-up?
backends/qualcomm/quantizer/utils.py
Outdated
| quant_max=torch.iinfo(torch.int8).max, | ||
| qscheme=torch.per_tensor_symmetric, | ||
| ch_axis=0, | ||
| observer_or_fake_quant_ctr=FusedMovingAvgObsFakeQuantize.with_args(observer=MovingAverageMinMaxObserver), |
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.
How about using MovingAveragePerChannelMinMaxObserver instead of MovingAverageMinMaxObserver, since we are going to do per-channel quantization for the weights?
FusedMovingAvgObsFakeQuantize.with_args(observer=MovingAveragePerChannelMinMaxObserver)
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 advice! Sorry for late reply because I was OoO.
If it's possible may we keep this for simplicity now? Currently we are working on different kind of quant confings for existing test cases. Once we finish we will update the quanziter with QAT.
Thank you very much for prompt reply! If it seems to be correct to you that will be really nice. Then we will move on to the coverage of qaunt configs. Thank you! Joey |
|
The QAT unit test matches the intent. For testing QAT on a real model, the easiest test is to apply QAT using the same dataset you use for PTQ calibration (e.g. Wiki) and the expectation is that loss should go down and the model metrics should be better than PTQ. Update: You can also test the QAT flow on any open-source imagenet models (e.g. mobilenet-v2). |
|
@cccclai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
cccclai
left a comment
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 @chunit-quic, should we merge this into main and iterate on this with real model? It will help internal running QAT as well.
|
We just need to fix the lint error and it should be good. |
Sorry for late reply. I was OoO previously . |
- Add qat proto - Add Unit test test_qnn_backend_linear_qat - Test command ```bash python backends/qualcomm/tests/test_qnn_delegate.py -H $HOST -s $DEVICE -b $build-android/ -m "SM8650" -r $EXECUTORCH_ROOT -k TestQNNQuantizedOperator.test_qnn_backend_linear_qat ```
9bec383 to
dd8ace6
Compare
|
@cccclai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |