Skip to content

Qualcomm AI Engine Direct - GA Albert, Bert, Distilbert, Eurobert #11546

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

Merged
merged 1 commit into from
Jun 17, 2025

Conversation

winskuo-quic
Copy link
Collaborator

Summary

This PR consists of 4 Encoder-Only models.
Following stats are based on SM8750.

  1. Albert (16a16w)
  • Accuracy: ~22% (NOTE: nn.Module accuracy is around 24%, so the similarity between QNN and nn.Module is around 92%)
  • Speed: 11ms/inf
  • Script: python examples/qualcomm/oss_scripts/albert.py -b build-android -s $DEVICE -m SM8750 --dataset ../wikipedia-sentences/wikisent2.txt
  1. Bert (16a8w)
  • Accuracy: ~60%
  • Speed: 9ms/inf
  • Script: python examples/qualcomm/oss_scripts/bert.py -b build-android -s $DEVICE -m SM8750 --dataset ../wikipedia-sentences/wikisent2.txt
  1. Distilbert (16a8w)
  • Accuracy: ~59%
  • Speed: 8ms/inf
  • Script: python examples/qualcomm/oss_scripts/distilbert.py -b build-android -s $DEVICE -m SM8750 --dataset ../wikipedia-sentences/wikisent2.txt
  1. Eurobert (16a16w)
  • Accuracy: ~54%
  • Speed: 40ms/inf
  • Script: python examples/qualcomm/oss_scripts/eurobert.py -b build-android -s $DEVICE -m SM8750 --dataset ../wikipedia-sentences/wikisent2.txt

Test plan

  • E2E Scripts under test_qnn_delegate.py
    • Example script: python backends/qualcomm/tests/test_qnn_delegate.py -k TestExampleOssScript.test_{BERT_MODEL} --model SM8750 -s $DEVICE --build_folder build-android/ -r ./ -a ./test --sentence_dataset ../wikipedia-sentences/wikisent2.txt
  • Mainline CI

Author: @haowhsu-quic, @chunit-quic, @winskuo-quic

@winskuo-quic winskuo-quic requested a review from cccclai as a code owner June 11, 2025 05:33
Copy link

pytorch-bot bot commented Jun 11, 2025

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/pytorch/executorch/11546

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

❌ 4 New Failures

As of commit 4a42e26 with merge base 6af28c9 (image):

NEW FAILURES - The following jobs have failed:

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

@facebook-github-bot facebook-github-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 Jun 11, 2025
@haowhsu-quic
Copy link
Collaborator

@pytorchbot label "release notes: qualcomm"

@pytorch-bot pytorch-bot bot added the release notes: qualcomm Changes to the Qualcomm backend delegate label Jun 11, 2025
@winskuo-quic winskuo-quic force-pushed the dev1/winskuo/eurobert branch 2 times, most recently from 16fa9d2 to e81eebe Compare June 11, 2025 09:03
@facebook-github-bot
Copy link
Contributor

@cccclai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

1 similar comment
@facebook-github-bot
Copy link
Contributor

@cccclai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@cccclai
Copy link
Contributor

cccclai commented Jun 13, 2025

Does test_qnn_backend_conv2d_channel_last test pass on your side? I saw error like this

AssertionError: False is not true : ref_output:
tensor([[[[-0.2671, -0.2526, -0.3288],
          [-0.4589, -0.6176, -0.1747],
          [-0.0699, -0.0861, -0.2032]],

         [[ 0.0599, -0.0134, -0.0674],
          [ 0.0606,  0.1011,  0.1408],
          [ 0.1816,  0.0160, -0.1697]]]])

model_output:
tensor([[[[-0.2668, -0.3289, -0.6177],
          [-0.0699, -0.2032, -0.0134],
          [ 0.0605,  0.1409,  0.0161]],

         [[-0.2527, -0.4590, -0.1747],
          [-0.0861,  0.0599, -0.0674],
          [ 0.1013,  0.1816, -0.1697]]]])

@winskuo-quic winskuo-quic force-pushed the dev1/winskuo/eurobert branch from e81eebe to 171bdac Compare June 13, 2025 08:23
@winskuo-quic
Copy link
Collaborator Author

Does test_qnn_backend_conv2d_channel_last test pass on your side? I saw error like this

AssertionError: False is not true : ref_output:
tensor([[[[-0.2671, -0.2526, -0.3288],
          [-0.4589, -0.6176, -0.1747],
          [-0.0699, -0.0861, -0.2032]],

         [[ 0.0599, -0.0134, -0.0674],
          [ 0.0606,  0.1011,  0.1408],
          [ 0.1816,  0.0160, -0.1697]]]])

model_output:
tensor([[[[-0.2668, -0.3289, -0.6177],
          [-0.0699, -0.2032, -0.0134],
          [ 0.0605,  0.1409,  0.0161]],

         [[-0.2527, -0.4590, -0.1747],
          [-0.0861,  0.0599, -0.0674],
          [ 0.1013,  0.1816, -0.1697]]]])

Thanks for catching this. Think I missed to update 1 file while rebasing. Please try again and it should be passing.

@facebook-github-bot
Copy link
Contributor

@cccclai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@cccclai
Copy link
Contributor

cccclai commented Jun 15, 2025

Looks like there is a conflict, can you rebase?

@winskuo-quic winskuo-quic force-pushed the dev1/winskuo/eurobert branch from 171bdac to 8663aee Compare June 16, 2025 02:33
@winskuo-quic
Copy link
Collaborator Author

Looks like there is a conflict, can you rebase?

I have rebased but seems like the lintruner cannot be properly initialized in CI.

@cccclai
Copy link
Contributor

cccclai commented Jun 17, 2025

Yeah it's fixed in main. Mind rebasing again?

@winskuo-quic winskuo-quic force-pushed the dev1/winskuo/eurobert branch from 86a2b53 to 192d30b Compare June 17, 2025 01:42
@winskuo-quic winskuo-quic force-pushed the dev1/winskuo/eurobert branch from 3f09fe8 to 4a42e26 Compare June 17, 2025 07:39
@facebook-github-bot
Copy link
Contributor

@cccclai has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator.

@cccclai cccclai merged commit 078fb23 into pytorch:main Jun 17, 2025
186 of 191 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. release notes: qualcomm Changes to the Qualcomm backend delegate
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants