qaihm-bot commited on
Commit
d130e22
·
verified ·
1 Parent(s): af504b4

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

Files changed (2) hide show
  1. LICENSE +2 -0
  2. README.md +154 -0
LICENSE ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ The license of the original trained model can be found at https://falconllm.tii.ae/falcon-terms-and-conditions.html.
2
+ The license for the deployable model files (.tflite, .onnx, .dlc, .bin, etc.) can be found at https://falconllm.tii.ae/falcon-terms-and-conditions.html.
README.md ADDED
@@ -0,0 +1,154 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ library_name: pytorch
3
+ license: other
4
+ tags:
5
+ - llm
6
+ - generative_ai
7
+ - android
8
+ pipeline_tag: text-generation
9
+
10
+ ---
11
+
12
+ ![](https://qaihub-public-assets.s3.us-west-2.amazonaws.com/qai-hub-models/models/falcon_v3_7b_instruct/web-assets/model_demo.png)
13
+
14
+ # Falcon3-7B-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
+ Falcon3 family of Open Foundation Models is a set of pretrained and instruct LLMs ranging from 1B to 10B.
19
+
20
+ This model is an implementation of Falcon3-7B-Instruct found [here](https://huggingface.co/tiiuae/Falcon3-7B-Instruct).
21
+
22
+
23
+ This repository provides scripts to run Falcon3-7B-Instruct on Qualcomm® devices.
24
+ More details on model performance across various devices, can be found
25
+ [here](https://aihub.qualcomm.com/models/falcon_v3_7b_instruct).
26
+
27
+
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
+ - Context length: 4096
35
+ - Precision: w4a16 + w8a16 (few layers)
36
+ - Num of key-value heads: 4
37
+ - Model-1 (Prompt Processor): PromptProcessor
38
+ - Prompt processor input: 128 tokens + position embeddings + attention mask + KV cache inputs
39
+ - Prompt processor output: 128 output tokens + KV cache outputs
40
+ - Model-2 (Token Generator): TokenGenerator
41
+ - Token generator input: 1 input token + position embeddings + attention mask + KV cache inputs
42
+ - Token generator output: 1 output token + KV cache outputs
43
+ - Use: Initiate conversation with prompt-processor and then token generator for subsequent iterations.
44
+ - Supported languages: English, French, Spanish, Portuguese.
45
+ - Minimum QNN SDK version required: 2.28.2
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
+ | Model | Precision | Device | Chipset | Target Runtime | Response Rate (tokens per second) | Time To First Token (range, seconds)
50
+ |---|---|---|---|---|---|
51
+ | Falcon3-7B-Instruct | w4a16 | Snapdragon 8 Elite QRD | Snapdragon® 8 Elite Mobile | GENIE | 14.02985 | 0.1265205 - 4.048656 | -- | Use Export Script |
52
+ | Falcon3-7B-Instruct | w4a16 | Snapdragon X Elite CRD | Snapdragon® X Elite | GENIE | 9.96829 | 0.1973798 - 6.3161536 | -- | Use Export Script |
53
+
54
+ ## Deploying Falcon3-7B-Instruct on-device
55
+
56
+ Please follow the [LLM on-device deployment](https://github.com/quic/ai-hub-apps/tree/main/tutorials/llm_on_genie) tutorial.
57
+
58
+
59
+
60
+ ## Installation
61
+
62
+
63
+ Install the package via pip:
64
+ ```bash
65
+ pip install "qai-hub-models[falcon-v3-7b-instruct]"
66
+ ```
67
+
68
+
69
+ ## Configure Qualcomm® AI Hub to run this model on a cloud-hosted device
70
+
71
+ Sign-in to [Qualcomm® AI Hub](https://app.aihub.qualcomm.com/) with your
72
+ Qualcomm® ID. Once signed in navigate to `Account -> Settings -> API Token`.
73
+
74
+ With this API token, you can configure your client to run models on the cloud
75
+ hosted devices.
76
+ ```bash
77
+ qai-hub configure --api_token API_TOKEN
78
+ ```
79
+ Navigate to [docs](https://app.aihub.qualcomm.com/docs/) for more information.
80
+
81
+
82
+
83
+ ## Demo off target
84
+
85
+ The package contains a simple end-to-end demo that downloads pre-trained
86
+ weights and runs this model on a sample input.
87
+
88
+ ```bash
89
+ python -m qai_hub_models.models.falcon_v3_7b_instruct.demo
90
+ ```
91
+
92
+ The above demo runs a reference implementation of pre-processing, model
93
+ inference, and post processing.
94
+
95
+ **NOTE**: If you want running in a Jupyter Notebook or Google Colab like
96
+ environment, please add the following to your cell (instead of the above).
97
+ ```
98
+ %run -m qai_hub_models.models.falcon_v3_7b_instruct.demo
99
+ ```
100
+
101
+
102
+ ### Run model on a cloud-hosted device
103
+
104
+ In addition to the demo, you can also run the model on a cloud-hosted Qualcomm®
105
+ device. This script does the following:
106
+ * Performance check on-device on a cloud-hosted device
107
+ * Downloads compiled assets that can be deployed on-device for Android.
108
+ * Accuracy check between PyTorch and on-device outputs.
109
+
110
+ ```bash
111
+ python -m qai_hub_models.models.falcon_v3_7b_instruct.export
112
+ ```
113
+
114
+
115
+
116
+
117
+
118
+
119
+ ## Deploying compiled model to Android
120
+
121
+
122
+ The models can be deployed using multiple runtimes:
123
+ - TensorFlow Lite (`.tflite` export): [This
124
+ tutorial](https://www.tensorflow.org/lite/android/quickstart) provides a
125
+ guide to deploy the .tflite model in an Android application.
126
+
127
+
128
+ - QNN (`.so` export ): This [sample
129
+ app](https://docs.qualcomm.com/bundle/publicresource/topics/80-63442-50/sample_app.html)
130
+ provides instructions on how to use the `.so` shared library in an Android application.
131
+
132
+
133
+ ## View on Qualcomm® AI Hub
134
+ Get more details on Falcon3-7B-Instruct's performance across various devices [here](https://aihub.qualcomm.com/models/falcon_v3_7b_instruct).
135
+ Explore all available models on [Qualcomm® AI Hub](https://aihub.qualcomm.com/)
136
+
137
+
138
+ ## License
139
+ * The license for the original implementation of Falcon3-7B-Instruct can be found
140
+ [here](https://falconllm.tii.ae/falcon-terms-and-conditions.html).
141
+ * The license for the compiled assets for on-device deployment can be found [here](https://falconllm.tii.ae/falcon-terms-and-conditions.html)
142
+
143
+
144
+
145
+ ## References
146
+ * [Source Model Implementation](https://huggingface.co/tiiuae/Falcon3-7B-Instruct)
147
+
148
+
149
+
150
+ ## Community
151
+ * Join [our AI Hub Slack community](https://aihub.qualcomm.com/community/slack) to collaborate, post questions and learn more about on-device AI.
152
+ * For questions or feedback please [reach out to us](mailto:[email protected]).
153
+
154
+