v0.46.1
Browse filesSee https://github.com/quic/ai-hub-models/releases/v0.46.1 for changelog.
Files changed (5)
- Beit_float.dlcDeleted-3
- Beit_float.onnx.zipDeleted-3
- Beit_float.tfliteDeleted-3
- README.md+74-227
- tool-versions.yamlDeleted-4
123version https://git-lfs.github.com/spec/v1oid sha256:a4822b2907107927eaa6717e2f33d7bfeda1acda7ad5c87984deb9139506238dsize 368438420123version https://git-lfs.github.com/spec/v1oid sha256:c36a0ea5d8571bc808b755c899b78921ddfd246ac41528f257ca3a5b4adb80easize 218717170123version https://git-lfs.github.com/spec/v1oid sha256:6cb77fa2b690e85ac5194efff636d0b8eb2c7530049054b6ecc8cd02295769e2size 3680853329 unmodified lines1011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532549 unmodified lines# Beit: Optimized for Mobile Deployment## Imagenet classifier and general purpose backboneBeit is a machine learning model that can classify images from the Imagenet dataset. It can also be used as a backbone in building more complex models for specific use cases.This model is an implementation of Beit found [here](https://github.com/microsoft/unilm/tree/master/beit).This repository provides scripts to run Beit on Qualcomm® devices.More details on model performance across various devices, can be found[here](https://aihub.qualcomm.com/models/beit).### Model Details- **Model Type:** Model_use_case.image_classification- **Model Stats:**- Model checkpoint: Imagenet- Input resolution: 224x224- Number of parameters: 92.0M- Model size (float): 351 MB| Model | Precision | Device | Chipset | Target Runtime | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit | Target Model|---|---|---|---|---|---|---|---|---|| Beit | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | TFLITE | 38.212 ms | 0 - 454 MB | NPU | [Beit.tflite](https://huggingface.co/qualcomm/Beit/blob/main/Beit.tflite) || Beit | float | QCS8275 (Proxy) | Qualcomm® QCS8275 (Proxy) | QNN_DLC | 42.233 ms | 1 - 468 MB | NPU | [Beit.dlc](https://huggingface.co/qualcomm/Beit/blob/main/Beit.dlc) || Beit | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | TFLITE | 19.369 ms | 0 - 481 MB | NPU | [Beit.tflite](https://huggingface.co/qualcomm/Beit/blob/main/Beit.tflite) || Beit | float | QCS8450 (Proxy) | Qualcomm® QCS8450 (Proxy) | QNN_DLC | 23.194 ms | 1 - 490 MB | NPU | [Beit.dlc](https://huggingface.co/qualcomm/Beit/blob/main/Beit.dlc) || Beit | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | TFLITE | 9.139 ms | 0 - 4 MB | NPU | [Beit.tflite](https://huggingface.co/qualcomm/Beit/blob/main/Beit.tflite) || Beit | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | QNN_DLC | 12.03 ms | 1 - 3 MB | NPU | [Beit.dlc](https://huggingface.co/qualcomm/Beit/blob/main/Beit.dlc) || Beit | float | QCS8550 (Proxy) | Qualcomm® QCS8550 (Proxy) | ONNX | 13.497 ms | 0 - 193 MB | NPU | [Beit.onnx.zip](https://huggingface.co/qualcomm/Beit/blob/main/Beit.onnx.zip) || Beit | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | TFLITE | 12.128 ms | 0 - 455 MB | NPU | [Beit.tflite](https://huggingface.co/qualcomm/Beit/blob/main/Beit.tflite) || Beit | float | QCS9075 (Proxy) | Qualcomm® QCS9075 (Proxy) | QNN_DLC | 67.728 ms | 1 - 468 MB | NPU | [Beit.dlc](https://huggingface.co/qualcomm/Beit/blob/main/Beit.dlc) || Beit | float | SA7255P ADP | Qualcomm® SA7255P | TFLITE | 38.212 ms | 0 - 454 MB | NPU | [Beit.tflite](https://huggingface.co/qualcomm/Beit/blob/main/Beit.tflite) || Beit | float | SA7255P ADP | Qualcomm® SA7255P | QNN_DLC | 42.233 ms | 1 - 468 MB | NPU | [Beit.dlc](https://huggingface.co/qualcomm/Beit/blob/main/Beit.dlc) || Beit | float | SA8295P ADP | Qualcomm® SA8295P | TFLITE | 16.879 ms | 0 - 447 MB | NPU | [Beit.tflite](https://huggingface.co/qualcomm/Beit/blob/main/Beit.tflite) || Beit | float | SA8295P ADP | Qualcomm® SA8295P | QNN_DLC | 19.772 ms | 1 - 457 MB | NPU | [Beit.dlc](https://huggingface.co/qualcomm/Beit/blob/main/Beit.dlc) || Beit | float | SA8775P ADP | Qualcomm® SA8775P | TFLITE | 12.128 ms | 0 - 455 MB | NPU | [Beit.tflite](https://huggingface.co/qualcomm/Beit/blob/main/Beit.tflite) || Beit | float | SA8775P ADP | Qualcomm® SA8775P | QNN_DLC | 67.728 ms | 1 - 468 MB | NPU | [Beit.dlc](https://huggingface.co/qualcomm/Beit/blob/main/Beit.dlc) || Beit | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | TFLITE | 6.384 ms | 0 - 509 MB | NPU | [Beit.tflite](https://huggingface.co/qualcomm/Beit/blob/main/Beit.tflite) || Beit | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | QNN_DLC | 8.192 ms | 1 - 520 MB | NPU | [Beit.dlc](https://huggingface.co/qualcomm/Beit/blob/main/Beit.dlc) || Beit | float | Samsung Galaxy S24 | Snapdragon® 8 Gen 3 Mobile | ONNX | 9.867 ms | 1 - 525 MB | NPU | [Beit.onnx.zip](https://huggingface.co/qualcomm/Beit/blob/main/Beit.onnx.zip) || Beit | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | TFLITE | 4.796 ms | 0 - 434 MB | NPU | [Beit.tflite](https://huggingface.co/qualcomm/Beit/blob/main/Beit.tflite) || Beit | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | QNN_DLC | 6.829 ms | 1 - 451 MB | NPU | [Beit.dlc](https://huggingface.co/qualcomm/Beit/blob/main/Beit.dlc) || Beit | float | Samsung Galaxy S25 | Snapdragon® 8 Elite For Galaxy Mobile | ONNX | 7.128 ms | 0 - 444 MB | NPU | [Beit.onnx.zip](https://huggingface.co/qualcomm/Beit/blob/main/Beit.onnx.zip) || Beit | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | TFLITE | 4.197 ms | 0 - 433 MB | NPU | [Beit.tflite](https://huggingface.co/qualcomm/Beit/blob/main/Beit.tflite) || Beit | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | QNN_DLC | 5.21 ms | 1 - 445 MB | NPU | [Beit.dlc](https://huggingface.co/qualcomm/Beit/blob/main/Beit.dlc) || Beit | float | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | ONNX | 5.928 ms | 1 - 433 MB | NPU | [Beit.onnx.zip](https://huggingface.co/qualcomm/Beit/blob/main/Beit.onnx.zip) || Beit | float | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_DLC | 12.735 ms | 1 - 1 MB | NPU | [Beit.dlc](https://huggingface.co/qualcomm/Beit/blob/main/Beit.dlc) || Beit | float | Snapdragon X Elite CRD | Snapdragon® X Elite | ONNX | 14.783 ms | 186 - 186 MB | NPU | [Beit.onnx.zip](https://huggingface.co/qualcomm/Beit/blob/main/Beit.onnx.zip) |## InstallationInstall the package via pip:```bash# NOTE: 3.10 <= PYTHON_VERSION < 3.14 is supported.pip install "qai-hub-models[beit]"```## Configure Qualcomm® AI Hub Workbench to run this model on a cloud-hosted deviceSign-in to [Qualcomm® AI Hub Workbench](https://workbench.aihub.qualcomm.com/) with yourQualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.With this API token, you can configure your client to run models on the cloudhosted devices.```bashqai-hub configure --api_token API_TOKEN```Navigate to [docs](https://workbench.aihub.qualcomm.com/docs/) for more information.## Demo off targetThe package contains a simple end-to-end demo that downloads pre-trainedweights and runs this model on a sample input.```bashpython -m qai_hub_models.models.beit.demo```The above demo runs a reference implementation of pre-processing, modelinference, and post processing.**NOTE**: If you want running in a Jupyter Notebook or Google Colab likeenvironment, please add the following to your cell (instead of the above).```%run -m qai_hub_models.models.beit.demo```### Run model on a cloud-hosted deviceIn addition to the demo, you can also run the model on a cloud-hosted Qualcomm®device. This script does the following:* Performance check on-device on a cloud-hosted device* Downloads compiled assets that can be deployed on-device for Android.* Accuracy check between PyTorch and on-device outputs.```bashpython -m qai_hub_models.models.beit.export```## How does this work?This [export script](https://aihub.qualcomm.com/models/beit/qai_hub_models/models/Beit/export.py)leverages [Qualcomm® AI Hub](https://aihub.qualcomm.com/) to optimize, validate, and deploy this modelon-device. Lets go through each step below in detail:Step 1: **Compile model for on-device deployment**To compile a PyTorch model for on-device deployment, we first trace the modelin memory using the `jit.trace` and then call the `submit_compile_job` API.```pythonimport torchimport qai_hub as hubfrom qai_hub_models.models.beit import Model# Load the modeltorch_model = Model.from_pretrained()# Devicedevice = hub.Device("Samsung Galaxy S25")# Trace modelinput_shape = torch_model.get_input_spec()sample_inputs = torch_model.sample_inputs()pt_model = torch.jit.trace(torch_model, [torch.tensor(data[0]) for _, data in sample_inputs.items()])# Compile model on a specific devicecompile_job = hub.submit_compile_job(model=pt_model,device=device,input_specs=torch_model.get_input_spec(),)# Get target model to run on-devicetarget_model = compile_job.get_target_model()```Step 2: **Performance profiling on cloud-hosted device**After compiling models from step 1. Models can be profiled model on-device using the`target_model`. Note that this scripts runs the model on a device automaticallyprovisioned in the cloud. Once the job is submitted, you can navigate to aprovided job URL to view a variety of on-device performance metrics.```pythonprofile_job = hub.submit_profile_job(model=target_model,device=device,)```Step 3: **Verify on-device accuracy**To verify the accuracy of the model on-device, you can run on-device inferenceon sample input data on the same cloud hosted device.```pythoninput_data = torch_model.sample_inputs()inference_job = hub.submit_inference_job(model=target_model,device=device,inputs=input_data,)on_device_output = inference_job.download_output_data()```With the output of the model, you can compute like PSNR, relative errors orspot check the output with expected output.**Note**: This on-device profiling and inference requires access to Qualcomm®AI Hub Workbench. [Sign up for access](https://myaccount.qualcomm.com/signup).## Run demo on a cloud-hosted deviceYou can also run the demo on-device.```bashpython -m qai_hub_models.models.beit.demo --eval-mode on-device```**NOTE**: If you want running in a Jupyter Notebook or Google Colab likeenvironment, please add the following to your cell (instead of the above).```%run -m qai_hub_models.models.beit.demo -- --eval-mode on-device```## Deploying compiled model to AndroidThe models can be deployed using multiple runtimes:- TensorFlow Lite (`.tflite` export): [Thistutorial](https://www.tensorflow.org/lite/android/quickstart) provides aguide to deploy the .tflite model in an Android application.- QNN (`.so` export ): This [sampleapp](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)provides instructions on how to use the `.so` shared library in an Android application.## View on Qualcomm® AI HubGet more details on Beit's performance across various devices [here](https://aihub.qualcomm.com/models/beit).Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)## License* The license for the original implementation of Beit can be found[here](https://github.com/pytorch/vision/blob/main/LICENSE).## References* [BEIT: BERT Pre-Training of Image Transformers](https://arxiv.org/abs/2106.08254)* [Source Model Implementation](https://github.com/microsoft/unilm/tree/master/beit)## Community* Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.* For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).9 unmodified lines1011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001019 unmodified lines# Beit: Optimized for Qualcomm DevicesBeit is a machine learning model that can classify images from the Imagenet dataset. It can also be used as a backbone in building more complex models for specific use cases.This is based on the implementation of Beit found [here](https://github.com/microsoft/unilm/tree/master/beit).This repository contains pre-exported model files optimized for Qualcomm® devices. You can use the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/beit) library to export with custom configurations. More details on model performance across various devices, can be found [here](#performance-summary).Qualcomm AI Hub Models uses [Qualcomm AI Hub Workbench](https://workbench.aihub.qualcomm.com) to compile, profile, and evaluate this model. [Sign up](https://myaccount.qualcomm.com/signup) to run these models on a hosted Qualcomm® device.## Getting StartedThere are two ways to deploy this model on your device:### Option 1: Download Pre-Exported ModelsBelow are pre-exported model assets ready for deployment.| Runtime | Precision | Chipset | SDK Versions | Download ||---|---|---|---|---|| ONNX | float | Universal | QAIRT 2.37, ONNX Runtime 1.23.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/beit/releases/v0.46.1/beit-onnx-float.zip)| QNN_DLC | float | Universal | QAIRT 2.42 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/beit/releases/v0.46.1/beit-qnn_dlc-float.zip)| QNN_DLC | w8a16 | Universal | QAIRT 2.42 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/beit/releases/v0.46.1/beit-qnn_dlc-w8a16.zip)| TFLITE | float | Universal | QAIRT 2.42, TFLite 2.17.0 | [Download](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/beit/releases/v0.46.1/beit-tflite-float.zip)For more device-specific assets and performance metrics, visit **[Beit on Qualcomm® AI Hub](https://aihub.qualcomm.com/models/beit)**.### Option 2: Export with Custom ConfigurationsUse the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/beit) Python library to compile and export the model with your own:- Custom weights (e.g., fine-tuned checkpoints)- Custom input shapes- Target device and runtime configurationsThis option is ideal if you need to customize the model beyond the default configuration provided here.See our repository for [Beit on GitHub](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/beit) for usage instructions.## Model Details**Model Type:** Model_use_case.image_classification**Model Stats:**- Model checkpoint: Imagenet- Input resolution: 224x224- Number of parameters: 92.0M- Model size (float): 351 MB## Performance Summary| Model | Runtime | Precision | Chipset | Inference Time (ms) | Peak Memory Range (MB) | Primary Compute Unit|---|---|---|---|---|---|---| Beit | ONNX | float | Snapdragon® X Elite | 14.768 ms | 186 - 186 MB | NPU| Beit | ONNX | float | Snapdragon® 8 Gen 3 Mobile | 9.876 ms | 0 - 524 MB | NPU| Beit | ONNX | float | Qualcomm® QCS8550 (Proxy) | 13.457 ms | 0 - 194 MB | NPU| Beit | ONNX | float | Qualcomm® QCS9075 | 20.562 ms | 0 - 4 MB | NPU| Beit | ONNX | float | Snapdragon® 8 Elite For Galaxy Mobile | 7.167 ms | 1 - 447 MB | NPU| Beit | ONNX | float | Snapdragon® 8 Elite Gen 5 Mobile | 5.932 ms | 0 - 436 MB | NPU| Beit | QNN_DLC | float | Snapdragon® X Elite | 13.534 ms | 1 - 1 MB | NPU| Beit | QNN_DLC | float | Snapdragon® 8 Gen 3 Mobile | 8.535 ms | 0 - 535 MB | NPU| Beit | QNN_DLC | float | Qualcomm® QCS8275 (Proxy) | 44.873 ms | 1 - 485 MB | NPU| Beit | QNN_DLC | float | Qualcomm® QCS8550 (Proxy) | 12.732 ms | 1 - 2 MB | NPU| Beit | QNN_DLC | float | Qualcomm® SA8775P | 15.563 ms | 1 - 485 MB | NPU| Beit | QNN_DLC | float | Qualcomm® QCS9075 | 16.84 ms | 1 - 3 MB | NPU| Beit | QNN_DLC | float | Qualcomm® QCS8450 (Proxy) | 22.993 ms | 0 - 507 MB | NPU| Beit | QNN_DLC | float | Qualcomm® SA7255P | 44.873 ms | 1 - 485 MB | NPU| Beit | QNN_DLC | float | Qualcomm® SA8295P | 19.001 ms | 1 - 468 MB | NPU| Beit | QNN_DLC | float | Snapdragon® 8 Elite For Galaxy Mobile | 7.003 ms | 1 - 478 MB | NPU| Beit | QNN_DLC | float | Snapdragon® 8 Elite Gen 5 Mobile | 6.475 ms | 1 - 481 MB | NPU| Beit | TFLITE | float | Snapdragon® 8 Gen 3 Mobile | 6.665 ms | 0 - 350 MB | NPU| Beit | TFLITE | float | Qualcomm® QCS8275 (Proxy) | 38.644 ms | 0 - 302 MB | NPU| Beit | TFLITE | float | Qualcomm® QCS8550 (Proxy) | 9.671 ms | 0 - 3 MB | NPU| Beit | TFLITE | float | Qualcomm® SA8775P | 12.131 ms | 0 - 310 MB | NPU| Beit | TFLITE | float | Qualcomm® QCS9075 | 13.331 ms | 0 - 187 MB | NPU| Beit | TFLITE | float | Qualcomm® QCS8450 (Proxy) | 19.271 ms | 0 - 433 MB | NPU| Beit | TFLITE | float | Qualcomm® SA7255P | 38.644 ms | 0 - 302 MB | NPU| Beit | TFLITE | float | Qualcomm® SA8295P | 16.047 ms | 0 - 410 MB | NPU| Beit | TFLITE | float | Snapdragon® 8 Elite For Galaxy Mobile | 4.824 ms | 0 - 302 MB | NPU| Beit | TFLITE | float | Snapdragon® 8 Elite Gen 5 Mobile | 4.065 ms | 0 - 304 MB | NPU## License* The license for the original implementation of Beit can be found[here](https://github.com/pytorch/vision/blob/main/LICENSE).## References* [BEIT: BERT Pre-Training of Image Transformers](https://arxiv.org/abs/2106.08254)* [Source Model Implementation](https://github.com/microsoft/unilm/tree/master/beit)## Community* Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.* For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
1234tool_versions: onnx: qairt: 2.37.1.250807093845_124904 onnx_runtime: 1.23.0Beit_float.dlcDeleted-3
Beit_float.onnx.zipDeleted-3
Beit_float.tfliteDeleted-3
README.md+74-227
tool-versions.yamlDeleted-4