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
If you encountered any bugs or issues following this tutorial please file a bug/issue here on [Github](https://github.com/pytorch/executorch/issues/new), or join our discord[here](https://lnkd.in/gWCM4ViK).
219
+
If you encountered any bugs or issues following this tutorial, please file a bug/issue here on [GitHub](https://github.com/pytorch/executorch/issues/new), or join our Discord[here](https://lnkd.in/gWCM4ViK).
* Download and link the Android NDK, and MediaTek ExecuTorch Libraries from the MediaTek Backend Readme ([link](https://github.com/pytorch/executorch/tree/main/backends/mediatek/scripts#prerequisites)).
13
13
* MediaTek Dimensity 9300 (D9300) chip device
14
-
* Desired Llama 3 model weights. You can download them on HuggingFace [Example](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)).
14
+
* Desired Llama 3 model weights. You can download them on Hugging Face ([Example](https://huggingface.co/meta-llama/Meta-Llama-3-8B-Instruct)).
15
15
* Download NeuroPilot Express SDK from the [MediaTek NeuroPilot Portal](https://neuropilot.mediatek.com/resources/public/npexpress/en/docs/npexpress):
16
16
-`libneuronusdk_adapter.mtk.so`: This universal SDK contains the implementation required for executing target-dependent code on the MediaTek chip.
17
17
-`libneuron_buffer_allocator.so`: This utility library is designed for allocating DMA buffers necessary for model inference.
18
-
-`mtk_converter-8.8.0.dev20240723+public.d1467db9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl`: This library preprocess the model into a MediaTek representation.
18
+
-`mtk_converter-8.8.0.dev20240723+public.d1467db9-cp310-cp310-manylinux_2_17_x86_64.manylinux2014_x86_64.whl`: This library preprocesses the model into a MediaTek representation.
19
19
-`mtk_neuron-8.2.2-py3-none-linux_x86_64.whl`: This library converts the model to binaries.
20
20
21
21
## Setup ExecuTorch
22
22
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://anaconda.org/anaconda/conda)). The commands below are running on Linux (CentOS).
23
23
24
-
Checkout ExecuTorch repo and sync submodules
24
+
Checkout ExecuTorch repo and sync submodules:
25
25
26
26
```
27
27
git clone -b viable/strict https://github.com/pytorch/executorch.git && cd executorch
* num_chunks*2 pte files: half are for prompt and the other half are for generation. Generation pte files are denoted by “1t” in the file name.
88
+
There will be 3 main sets of files generated:
89
+
* num_chunks*2 .pte files: half are for prompt and the other half are for generation. Generation .pte files are denoted by “1t” in the file name.
90
90
* Token embedding bin file: located in the weights folder where `config.json` is placed (`examples/mediatek/modes/llm_models/weight/<model_name>/embedding_<model_name>_fp32.bin`)
91
91
* Tokenizer file: `tokenizer.model` file
92
92
93
-
Note: Exporting model flow can take 2.5 hours (114GB RAM for num_chunks=4) to complete. (Results may vary depending on hardware)
93
+
Note: The exporting model flow can take 2.5 hours (114GB RAM for num_chunks=4) to complete. Results may vary depending on hardware.
94
94
95
-
Before continuing forward, make sure to modify the tokenizer, token embedding, and model paths in the examples/mediatek/executor_runner/run_llama3_sample.sh.
95
+
Before continuing forward, make sure to modify the tokenizer, token embedding, and model paths in the `examples/mediatek/executor_runner/run_llama3_sample.sh` file.
96
96
97
97
### Deploy
98
98
First, make sure your Android phone’s chipset version is compatible with this demo (MediaTek Dimensity 9300 (D9300)) chip. Once you have the model, tokenizer, and runner generated ready, you can push them and the .so files to the device before we start running using the runner via shell.
99
99
100
100
```
101
-
adb shell mkdir -p /data/local/tmp/et-mtk/ (or any other directory name)
101
+
adb shell mkdir -p /data/local/tmp/et-mtk/ # or any other directory name
The Mediatek runner (`examples/mediatek/executor_runner/mtk_llama_runner.cpp`) contains the logic for implementing the function calls that come from the Android app.
116
+
The MediaTek runner (`examples/mediatek/executor_runner/mtk_llama_runner.cpp`) contains the logic for implementing the function calls that come from the Android app.
117
117
118
-
**Important!** Currently the model paths are set in the runner-level. Modify the values in `examples/mediatek/executor_runner/llama_runner/llm_helper/include/llama_runner_values.h` to set the model paths, tokenizer path, embedding file path, and other metadata.
118
+
**Important!** Currently the model paths are set at the runnerlevel. Modify the values in `examples/mediatek/executor_runner/llama_runner/llm_helper/include/llama_runner_values.h` to set the model paths, tokenizer path, embedding file path, and other metadata.
119
119
120
120
121
121
## Build AAR Library
122
-
1. Open a terminal window and navigate to the root directory of the executorch
122
+
1. Open a terminal window and navigate to the root directory of the ExecuTorch:
@@ -179,4 +179,4 @@ Once you've loaded the app on the device:
179
179
3. Click the "Load Model" button. This will load the models from the Runner
180
180
181
181
## Reporting Issues
182
-
If you encountered any bugs or issues following this tutorial please file a bug/issue here on [Github](https://github.com/pytorch/executorch/issues/new).
182
+
If you encountered any bugs or issues following this tutorial, please file a bug/issue here on [GitHub](https://github.com/pytorch/executorch/issues/new).
0 commit comments