v0.36.0
Browse filesSee https://github.com/quic/ai-hub-models/releases/v0.36.0 for changelog.
README.md
CHANGED
|
@@ -20,7 +20,11 @@ Llama 3 is a family of LLMs. The model is quantized to w4a16 (4-bit weights and
|
|
| 20 |
This model is an implementation of Llama-v3-8B-Instruct found [here](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct/).
|
| 21 |
|
| 22 |
|
| 23 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 24 |
|
| 25 |
### Model Details
|
| 26 |
|
|
@@ -44,9 +48,9 @@ This model is an implementation of Llama-v3-8B-Instruct found [here](https://hug
|
|
| 44 |
|
| 45 |
| Model | Precision | Device | Chipset | Target Runtime | Response Rate (tokens per second) | Time To First Token (range, seconds)
|
| 46 |
|---|---|---|---|---|---|
|
| 47 |
-
| Llama-v3-8B-
|
| 48 |
-
| Llama-v3-8B-
|
| 49 |
-
| Llama-v3-8B-
|
| 50 |
|
| 51 |
## Deploying Llama 3 on-device
|
| 52 |
|
|
@@ -54,6 +58,84 @@ Please follow the [LLM on-device deployment](https://github.com/quic/ai-hub-apps
|
|
| 54 |
|
| 55 |
|
| 56 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 57 |
## License
|
| 58 |
* The license for the original implementation of Llama-v3-8B-Instruct can be found
|
| 59 |
[here](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct/blob/main/LICENSE).
|
|
@@ -68,26 +150,7 @@ Please follow the [LLM on-device deployment](https://github.com/quic/ai-hub-apps
|
|
| 68 |
|
| 69 |
|
| 70 |
## Community
|
| 71 |
-
* Join [our AI Hub Slack community](https://qualcomm
|
| 72 |
* For questions or feedback please [reach out to us](mailto:[email protected]).
|
| 73 |
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
Model may not be used for or in connection with any of the following applications:
|
| 77 |
-
|
| 78 |
-
- Accessing essential private and public services and benefits;
|
| 79 |
-
- Administration of justice and democratic processes;
|
| 80 |
-
- Assessing or recognizing the emotional state of a person;
|
| 81 |
-
- Biometric and biometrics-based systems, including categorization of persons based on sensitive characteristics;
|
| 82 |
-
- Education and vocational training;
|
| 83 |
-
- Employment and workers management;
|
| 84 |
-
- Exploitation of the vulnerabilities of persons resulting in harmful behavior;
|
| 85 |
-
- General purpose social scoring;
|
| 86 |
-
- Law enforcement;
|
| 87 |
-
- Management and operation of critical infrastructure;
|
| 88 |
-
- Migration, asylum and border control management;
|
| 89 |
-
- Predictive policing;
|
| 90 |
-
- Real-time remote biometric identification in public spaces;
|
| 91 |
-
- Recommender systems of social media platforms;
|
| 92 |
-
- Scraping of facial images (from the internet or otherwise); and/or
|
| 93 |
-
- Subliminal manipulation
|
|
|
|
| 20 |
This model is an implementation of Llama-v3-8B-Instruct found [here](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct/).
|
| 21 |
|
| 22 |
|
| 23 |
+
This repository provides scripts to run Llama-v3-8B-Instruct on Qualcomm® devices.
|
| 24 |
+
More details on model performance across various devices, can be found
|
| 25 |
+
[here](https://aihub.qualcomm.com/models/llama_v3_8b_instruct).
|
| 26 |
+
|
| 27 |
+
**WARNING**: The model assets are not readily available for download due to licensing restrictions.
|
| 28 |
|
| 29 |
### Model Details
|
| 30 |
|
|
|
|
| 48 |
|
| 49 |
| Model | Precision | Device | Chipset | Target Runtime | Response Rate (tokens per second) | Time To First Token (range, seconds)
|
| 50 |
|---|---|---|---|---|---|
|
| 51 |
+
| Llama-v3-8B-Instruct | w4a16 | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | QNN_CONTEXT_BINARY | 12.9262 | 0.159383 - 5.100256 | -- | -- |
|
| 52 |
+
| Llama-v3-8B-Instruct | w4a16 | Snapdragon X Elite CRD | Snapdragon® X Elite | QNN_CONTEXT_BINARY | 10.0367 | 0.211644 - 6.772608 | -- | -- |
|
| 53 |
+
| Llama-v3-8B-Instruct | w4a16 | SA8255P ADP | Qualcomm® SA8255P | QNN_CONTEXT_BINARY | 7.55837 | 0.3644368 - 11.6619776 | -- | -- |
|
| 54 |
|
| 55 |
## Deploying Llama 3 on-device
|
| 56 |
|
|
|
|
| 58 |
|
| 59 |
|
| 60 |
|
| 61 |
+
## Installation
|
| 62 |
+
|
| 63 |
+
|
| 64 |
+
Install the package via pip:
|
| 65 |
+
```bash
|
| 66 |
+
pip install "qai-hub-models[llama-v3-8b-instruct]"
|
| 67 |
+
```
|
| 68 |
+
|
| 69 |
+
|
| 70 |
+
## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
|
| 71 |
+
|
| 72 |
+
Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
|
| 73 |
+
Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
|
| 74 |
+
|
| 75 |
+
With this API token, you can configure your client to run models on the cloud
|
| 76 |
+
hosted devices.
|
| 77 |
+
```bash
|
| 78 |
+
qai-hub configure --api_token API_TOKEN
|
| 79 |
+
```
|
| 80 |
+
Navigate to [docs](https://app.aihub.qualcomm.com/docs/) for more information.
|
| 81 |
+
|
| 82 |
+
|
| 83 |
+
|
| 84 |
+
## Demo off target
|
| 85 |
+
|
| 86 |
+
The package contains a simple end-to-end demo that downloads pre-trained
|
| 87 |
+
weights and runs this model on a sample input.
|
| 88 |
+
|
| 89 |
+
```bash
|
| 90 |
+
python -m qai_hub_models.models.llama_v3_8b_instruct.demo
|
| 91 |
+
```
|
| 92 |
+
|
| 93 |
+
The above demo runs a reference implementation of pre-processing, model
|
| 94 |
+
inference, and post processing.
|
| 95 |
+
|
| 96 |
+
**NOTE**: If you want running in a Jupyter Notebook or Google Colab like
|
| 97 |
+
environment, please add the following to your cell (instead of the above).
|
| 98 |
+
```
|
| 99 |
+
%run -m qai_hub_models.models.llama_v3_8b_instruct.demo
|
| 100 |
+
```
|
| 101 |
+
|
| 102 |
+
|
| 103 |
+
### Run model on a cloud-hosted device
|
| 104 |
+
|
| 105 |
+
In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
|
| 106 |
+
device. This script does the following:
|
| 107 |
+
* Performance check on-device on a cloud-hosted device
|
| 108 |
+
* Downloads compiled assets that can be deployed on-device for Android.
|
| 109 |
+
* Accuracy check between PyTorch and on-device outputs.
|
| 110 |
+
|
| 111 |
+
```bash
|
| 112 |
+
python -m qai_hub_models.models.llama_v3_8b_instruct.export
|
| 113 |
+
```
|
| 114 |
+
|
| 115 |
+
|
| 116 |
+
|
| 117 |
+
|
| 118 |
+
|
| 119 |
+
|
| 120 |
+
## Deploying compiled model to Android
|
| 121 |
+
|
| 122 |
+
|
| 123 |
+
The models can be deployed using multiple runtimes:
|
| 124 |
+
- TensorFlow Lite (`.tflite` export): [This
|
| 125 |
+
tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
|
| 126 |
+
guide to deploy the .tflite model in an Android application.
|
| 127 |
+
|
| 128 |
+
|
| 129 |
+
- QNN (`.so` export ): This [sample
|
| 130 |
+
app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
|
| 131 |
+
provides instructions on how to use the `.so` shared library in an Android application.
|
| 132 |
+
|
| 133 |
+
|
| 134 |
+
## View on Qualcomm® AI Hub
|
| 135 |
+
Get more details on Llama-v3-8B-Instruct's performance across various devices [here](https://aihub.qualcomm.com/models/llama_v3_8b_instruct).
|
| 136 |
+
Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
|
| 137 |
+
|
| 138 |
+
|
| 139 |
## License
|
| 140 |
* The license for the original implementation of Llama-v3-8B-Instruct can be found
|
| 141 |
[here](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct/blob/main/LICENSE).
|
|
|
|
| 150 |
|
| 151 |
|
| 152 |
## Community
|
| 153 |
+
* Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
|
| 154 |
* For questions or feedback please [reach out to us](mailto:[email protected]).
|
| 155 |
|
| 156 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|