You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/demo-apps/apple_ios/LLaMA/docs/delegates/xnnpack_README.md
+22-20Lines changed: 22 additions & 20 deletions
Original file line number
Diff line number
Diff line change
@@ -1,17 +1,16 @@
1
-
# Building Llama iOS Demo for XNNPack Backend
1
+
# Building Llama iOS Demo for XNNPACK Backend
2
2
3
-
**[UPDATE - 09/25]** We have added support for running [Llama 3.2 models](#for-llama-32-1b-and-3b-models) on the XNNPack backend. We currently support inference on their original data type (BFloat16).
3
+
**[UPDATE - 09/25]** We have added support for running [Llama 3.2 models](#for-llama-32-1b-and-3b-models) on the XNNPACK backend. We currently support inference on their original data type (BFloat16).
4
4
5
-
This tutorial covers the end to end workflow for building an iOS demo app using XNNPack backend on device.
5
+
This tutorial covers the end to end workflow for building an iOS demo app using XNNPACK backend on device.
6
6
More specifically, it covers:
7
-
1. Export and quantization of Llama models against the XNNPack backend.
8
-
2. Building and linking libraries that are required to inference on-device for iOS platform using XNNPack.
7
+
1. Export and quantization of Llama models against the XNNPACK backend.
8
+
2. Building and linking libraries that are required to inference on-device for iOS platform using XNNPACK.
9
9
3. Building the iOS demo app itself.
10
10
11
11
## Prerequisites
12
12
*[Xcode 15](https://developer.apple.com/xcode)
13
13
*[iOS 17 SDK](https://developer.apple.com/ios)
14
-
* Set up your ExecuTorch repo and environment if you haven’t done so by following the [Setting up ExecuTorch](https://pytorch.org/executorch/stable/getting-started-setup) to set up the repo and dev environment:
15
14
16
15
## Setup ExecuTorch
17
16
In this section, we will need to set up the ExecuTorch repo first with Conda environment management. Make sure you have Conda available in your system (or follow the instructions to install it [here](https://conda.io/projects/conda/en/latest/user-guide/install/index.html)). The commands below are running on Linux (CentOS).
@@ -48,7 +47,7 @@ sh examples/models/llama2/install_requirements.sh
48
47
```
49
48
50
49
### For Llama 3.2 1B and 3B models
51
-
We have supported BFloat16 as a data type on the XNNPack backend for Llama 3.2 1B/3B models.
50
+
We have supported BFloat16 as a data type on the XNNPACK backend for Llama 3.2 1B/3B models.
52
51
* You can download original model weights for Llama through Meta official [website](https://llama.meta.com/).
53
52
* For chat use-cases, download the instruct models instead of pretrained.
54
53
* Run “examples/models/llama2/install_requirements.sh” to install dependencies.
@@ -59,8 +58,6 @@ We have supported BFloat16 as a data type on the XNNPack backend for Llama 3.2 1
* Convert tokenizer for Llama 3.2 - Rename 'tokenizer.model' to 'tokenizer.bin'.
63
-
64
61
For more detail using Llama 3.2 lightweight models including prompt template, please go to our official [website](https://www.llama.com/docs/model-cards-and-prompt-formats/llama3_2#-llama-3.2-lightweight-models-(1b/3b)-).
Click “Run” to build the app and run in on your iPhone. If the app successfully run on your device, you should see something like below:
124
+
Click “Run” to build the app and run in on your iPhone.
125
+
126
+
## Pushing Model and Tokenizer
127
+
128
+
### Copy the model to Simulator
129
+
* Drag&drop the model and tokenizer files onto the Simulator window and save them somewhere inside the iLLaMA folder.
130
+
* Pick the files in the app dialog, type a prompt and click the arrow-up button.
131
+
132
+
### Copy the model to Device
133
+
* Wire-connect the device and open the contents in Finder.
134
+
* Navigate to the Files tab and drag & drop the model and tokenizer files onto the iLLaMA folder.
135
+
* Wait until the files are copied.
136
+
137
+
Open the iLLaMA app, click the settings button at the top left of the app to select the model and tokenizer files. When the app successfully runs on your device, you should see something like below:
0 commit comments