qaihm-bot commited on
Commit
4b6d1b9
·
verified ·
1 Parent(s): 09487b0

See https://github.com/quic/ai-hub-models/releases/v0.46.1 for changelog.

Files changed (1) hide show
  1. README.md +49 -109
README.md CHANGED
@@ -11,140 +11,80 @@ pipeline_tag: text-generation
11
 
12
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/llama_v3_2_3b_instruct/web-assets/model_demo.png)
13
 
14
- # Llama-v3.2-3B-Instruct: Optimized for Mobile Deployment
15
- ## State-of-the-art large language model useful on a variety of language understanding and generation tasks
16
-
17
 
18
  Llama 3 is a family of LLMs. The model is quantized to w4a16 (4-bit weights and 16-bit activations) and part of the model is quantized to w8a16 (8-bit weights and 16-bit activations) making it suitable for on-device deployment.
19
 
20
- This model is an implementation of Llama-v3.2-3B-Instruct found [here](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct/).
21
-
22
-
23
- This repository provides scripts to run Llama-v3.2-3B-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_2_3b_instruct).
26
-
27
- **WARNING**: The model assets are not readily available for download due to licensing restrictions.
28
-
29
- ### Model Details
30
 
31
- - **Model Type:** Model_use_case.text_generation
32
- - **Model Stats:**
33
- - Input sequence length for Prompt Processor: 128
34
- - Maximum context length: 4096
35
- - Precision: w4 + w8 (few layers) with fp16 activations and w4a16 + w8a16 (few layers) are supported
36
- - Supported languages: English.
37
- - TTFT: Time To First Token is the time it takes to generate the first response token. This is expressed as a range because it varies based on the length of the prompt. The lower bound is for a short prompt (up to 128 tokens, i.e., one iteration of the prompt processor) and the upper bound is for a prompt using the full context length (4096 tokens).
38
- - Response Rate: Rate of response generation after the first response token.
39
-
40
- | Model | Precision | Device | Chipset | Target Runtime | Response Rate (tokens per second) | Time To First Token (range, seconds)
41
- |---|---|---|---|---|---|
42
- | Llama-v3.2-3B-Instruct | w4a16 | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | GENIE | 29.48402 | 0.058016 - 1.856531 | -- | -- |
43
- | Llama-v3.2-3B-Instruct | w4a16 | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | GENIE | 23.4718 | 0.088195 - 2.82225 | -- | -- |
44
- | Llama-v3.2-3B-Instruct | w4a16 | Snapdragon X Elite CRD | Snapdragon® X Elite | GENIE | 18.4176 | 0.12593600000000002 - 4.029952000000001 | -- | -- |
45
- | Llama-v3.2-3B-Instruct | w4 | Snapdragon 8 Elite Gen 5 QRD | Snapdragon® 8 Elite Gen 5 Mobile | GENIE | 18.00883 | 0.131546 - 4.209475 | -- | -- |
46
- | Llama-v3.2-3B-Instruct | w4 | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | GENIE | 13.83 | 0.088195 - 2.82225 | -- | -- |
47
- | Llama-v3.2-3B-Instruct | w4 | SA8295P ADP | Qualcomm® SA8295P | GENIE | 3.523 | 0.37311700000000003 - 2.9849360000000003 | -- | -- |
48
 
49
  ## Deploying Llama 3.2 3B on-device
50
 
51
  Please follow the [LLM on-device deployment](https://github.com/quic/ai-hub-apps/tree/main/tutorials/llm_on_genie) tutorial.
52
 
 
 
 
 
 
 
53
 
 
54
 
55
- ## Installation
56
-
57
-
58
- Install the package via pip:
59
- ```bash
60
- # NOTE: 3.10 <= PYTHON_VERSION < 3.14 is supported.
61
- pip install "qai-hub-models[llama-v3-2-3b-instruct]"
62
- ```
63
-
64
-
65
- ## Configure Qualcomm® AI Hub Workbench to run this model on a cloud-hosted device
66
-
67
- Sign-in to [Qualcomm® AI Hub Workbench](https://workbench.aihub.qualcomm.com/) with your
68
- Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
69
-
70
- With this API token, you can configure your client to run models on the cloud
71
- hosted devices.
72
- ```bash
73
- qai-hub configure --api_token API_TOKEN
74
- ```
75
- Navigate to [docs](https://workbench.aihub.qualcomm.com/docs/) for more information.
76
-
77
-
78
-
79
- ## Demo off target
80
-
81
- The package contains a simple end-to-end demo that downloads pre-trained
82
- weights and runs this model on a sample input.
83
-
84
- ```bash
85
- python -m qai_hub_models.models.llama_v3_2_3b_instruct.demo
86
- ```
87
-
88
- The above demo runs a reference implementation of pre-processing, model
89
- inference, and post processing.
90
-
91
- **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
92
- environment, please add the following to your cell (instead of the above).
93
- ```
94
- %run -m qai_hub_models.models.llama_v3_2_3b_instruct.demo
95
- ```
96
 
 
97
 
98
- ### Run model on a cloud-hosted device
99
 
100
- In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
101
- device. This script does the following:
102
- * Performance check on-device on a cloud-hosted device
103
- * Downloads compiled assets that can be deployed on-device for Android.
104
- * Accuracy check between PyTorch and on-device outputs.
105
-
106
- ```bash
107
- python -m qai_hub_models.models.llama_v3_2_3b_instruct.export
108
- ```
109
-
110
-
111
-
112
-
113
-
114
-
115
- ## Deploying compiled model to Android
116
-
117
-
118
- The models can be deployed using multiple runtimes:
119
- - TensorFlow Lite (`.tflite` export): [This
120
- tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
121
- guide to deploy the .tflite model in an Android application.
122
-
123
-
124
- - QNN (`.so` export ): This [sample
125
- app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
126
- provides instructions on how to use the `.so` shared library in an Android application.
127
-
128
-
129
- ## View on Qualcomm® AI Hub
130
- Get more details on Llama-v3.2-3B-Instruct's performance across various devices [here](https://aihub.qualcomm.com/models/llama_v3_2_3b_instruct).
131
- Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
132
 
 
 
 
 
 
 
 
 
 
133
 
134
  ## License
135
  * The license for the original implementation of Llama-v3.2-3B-Instruct can be found
136
  [here](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct/blob/main/LICENSE.txt).
137
 
138
-
139
-
140
  ## References
141
  * [LLaMA: Open and Efficient Foundation Language Models](https://www.llama.com/docs/model-cards-and-prompt-formats/llama3_2/)
142
  * [Source Model Implementation](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct/)
143
 
144
-
145
-
146
  ## Community
147
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
148
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
149
 
150
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
11
 
12
  ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/llama_v3_2_3b_instruct/web-assets/model_demo.png)
13
 
14
+ # Llama-v3.2-3B-Instruct: Optimized for Qualcomm Devices
 
 
15
 
16
  Llama 3 is a family of LLMs. The model is quantized to w4a16 (4-bit weights and 16-bit activations) and part of the model is quantized to w8a16 (8-bit weights and 16-bit activations) making it suitable for on-device deployment.
17
 
18
+ This is based on the implementation of Llama-v3.2-3B-Instruct found [here](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct/).
19
+ 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/llama_v3_2_3b_instruct) library to export with custom configurations. More details on model performance across various devices, can be found [here](#performance-summary).
 
 
 
 
 
 
 
 
20
 
21
+ 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.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
  ## Deploying Llama 3.2 3B on-device
24
 
25
  Please follow the [LLM on-device deployment](https://github.com/quic/ai-hub-apps/tree/main/tutorials/llm_on_genie) tutorial.
26
 
27
+ ## Getting Started
28
+ Due to licensing restrictions, we cannot distribute pre-exported model assets for this model.
29
+ Use the [Qualcomm® AI Hub Models](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/llama_v3_2_3b_instruct) Python library to compile and export the model with your own:
30
+ - Custom weights (e.g., fine-tuned checkpoints)
31
+ - Custom input shapes
32
+ - Target device and runtime configurations
33
 
34
+ See our repository for [Llama-v3.2-3B-Instruct on GitHub](https://github.com/quic/ai-hub-models/blob/main/qai_hub_models/models/llama_v3_2_3b_instruct) for usage instructions.
35
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
36
 
37
+ ## Model Details
38
 
39
+ **Model Type:** Model_use_case.text_generation
40
 
41
+ **Model Stats:**
42
+ - Input sequence length for Prompt Processor: 128
43
+ - Maximum context length: 4096
44
+ - Precision: w4 + w8 (few layers) with fp16 activations and w4a16 + w8a16 (few layers) are supported
45
+ - Supported languages: English.
46
+ - TTFT: Time To First Token is the time it takes to generate the first response token. This is expressed as a range because it varies based on the length of the prompt. The lower bound is for a short prompt (up to 128 tokens, i.e., one iteration of the prompt processor) and the upper bound is for a prompt using the full context length (4096 tokens).
47
+ - Response Rate: Rate of response generation after the first response token.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
48
 
49
+ ## Performance Summary
50
+ | Model | Runtime | Precision | Chipset | Context Length | Response Rate (tokens per second) | Time To First Token (range, seconds)
51
+ |---|---|---|---|---|---|---
52
+ | Llama-v3.2-3B-Instruct | GENIE | w4 | Snapdragon® 8 Elite Mobile | 4096 | 13.83 | 0.088195 - 2.82225
53
+ | Llama-v3.2-3B-Instruct | GENIE | w4 | Qualcomm® SA8295P | 1024 | 3.523 | 0.37311700000000003 - 2.9849360000000003
54
+ | Llama-v3.2-3B-Instruct | GENIE | w4 | Snapdragon® 8 Elite Gen 5 Mobile | 4096 | 18.00883 | 0.131546 - 4.209475
55
+ | Llama-v3.2-3B-Instruct | GENIE | w4a16 | Snapdragon® 8 Elite Mobile | 4096 | 23.4718 | 0.088195 - 2.82225
56
+ | Llama-v3.2-3B-Instruct | GENIE | w4a16 | Snapdragon® X Elite | 4096 | 18.4176 | 0.12593600000000002 - 4.029952000000001
57
+ | Llama-v3.2-3B-Instruct | GENIE | w4a16 | Snapdragon® 8 Elite Gen 5 Mobile | 4096 | 29.48402 | 0.058016 - 1.856531
58
 
59
  ## License
60
  * The license for the original implementation of Llama-v3.2-3B-Instruct can be found
61
  [here](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct/blob/main/LICENSE.txt).
62
 
 
 
63
  ## References
64
  * [LLaMA: Open and Efficient Foundation Language Models](https://www.llama.com/docs/model-cards-and-prompt-formats/llama3_2/)
65
  * [Source Model Implementation](https://huggingface.co/meta-llama/Llama-3.2-3B-Instruct/)
66
 
 
 
67
  ## Community
68
  * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
69
  * For questions or feedback please [reach out to us](mailto:ai-hub-support@qti.qualcomm.com).
70
 
71
+ ## Usage and Limitations
72
+
73
+ This model may not be used for or in connection with any of the following applications:
74
+
75
+ - Accessing essential private and public services and benefits;
76
+ - Administration of justice and democratic processes;
77
+ - Assessing or recognizing the emotional state of a person;
78
+ - Biometric and biometrics-based systems, including categorization of persons based on sensitive characteristics;
79
+ - Education and vocational training;
80
+ - Employment and workers management;
81
+ - Exploitation of the vulnerabilities of persons resulting in harmful behavior;
82
+ - General purpose social scoring;
83
+ - Law enforcement;
84
+ - Management and operation of critical infrastructure;
85
+ - Migration, asylum and border control management;
86
+ - Predictive policing;
87
+ - Real-time remote biometric identification in public spaces;
88
+ - Recommender systems of social media platforms;
89
+ - Scraping of facial images (from the internet or otherwise); and/or
90
+ - Subliminal manipulation