Skip to content

Commit 9ed4622

Browse files
authored
Merge pull request #1346 from madeline-underwood/Executorch_Kleid
Executorch kleid_NS to check
2 parents e476ff3 + dc7f725 commit 9ed4622

File tree

7 files changed

+24
-23
lines changed

7 files changed

+24
-23
lines changed

content/learning-paths/smartphones-and-mobile/Build-Llama3-Chat-Android-App-Using-Executorch-And-XNNPACK/1-dev-env-setup.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,23 +16,23 @@ The first step is to prepare a development environment with the required softwar
1616
- Android NDK version 28.0.12433566.
1717
- Java 17 JDK.
1818
- Git.
19-
- Python 3.10 or later (these instructions have been tested with 3.10 and 3.12)
19+
- Python 3.10 or later (these instructions have been tested with 3.10 and 3.12).
2020

21-
The instructions assume macOS with Apple Silicon, an x86 Debian, or Ubuntu Linux machine with at least 16GB of RAM.
21+
The instructions assume macOS with Apple Silicon, an x86 Debian, or an Ubuntu Linux machine, with at least 16GB of RAM.
2222

2323
## Install Android Studio and Android NDK
2424

2525
Follow these steps to install and configure Android Studio:
2626

2727
1. Download and install the latest version of [Android Studio](https://developer.android.com/studio/).
2828

29-
2. Start Android Studio and open the `Settings` dialog.
29+
2. Start Android Studio and open the **Settings** dialog.
3030

31-
3. Navigate to `Languages & Frameworks -> Android SDK`.
31+
3. Navigate to **Languages & Frameworks**, then **Android SDK**.
3232

33-
4. In the `SDK Platforms` tab, check `Android 14.0 ("UpsideDownCake")`.
33+
4. In the **SDK Platforms** tab, check **Android 14.0 ("UpsideDownCake")**.
3434

35-
Next, install the specific version of the Android NDK that you need by first installing the Android command line tools:
35+
Next, install the specific version of the Android NDK that you require by first installing the Android command line tools:
3636

3737
Linux:
3838

@@ -52,7 +52,7 @@ Unzip the Android command line tools:
5252
unzip commandlinetools.zip -d android-sdk
5353
```
5454

55-
Install the NDK in the directory that Android Studio installed the SDK. This is generally `~/Library/Android/sdk` by default. Set the requirement environment variables:
55+
Install the NDK in the same directory that Android Studio installed the SDK. This is generally `~/Library/Android/sdk` by default. Set the requirement environment variables:
5656

5757
```
5858
export ANDROID_HOME="$(realpath ~/Library/Android/sdk)"

content/learning-paths/smartphones-and-mobile/Build-Llama3-Chat-Android-App-Using-Executorch-And-XNNPACK/2-executorch-setup.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,13 +19,13 @@ python3.10 -m venv executorch
1919
source executorch/bin/activate
2020
```
2121

22-
The prompt of your terminal has (executorch) as a prefix to indicate the virtual environment is active.
22+
The prompt of your terminal has `executorch` as a prefix to indicate the virtual environment is active.
2323

2424
### Option 2: Create a Conda virtual environment
2525

2626
Install Miniconda on your development machine by following the [Installing conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) instructions.
2727

28-
Once `conda` is installed create the environment:
28+
Once `conda` is installed, create the environment:
2929

3030
```bash
3131
conda create -yn executorch python=3.10.0
@@ -46,4 +46,4 @@ git submodule update --init
4646
./examples/models/llama/install_requirements.sh
4747
```
4848

49-
When these scripts finish successfully, ExecuTorch is all set up. That means it's time to dive into the world of Llama models!
49+
When these scripts finish successfully, ExecuTorch is set up. That means it's time to dive into the world of Llama models!

content/learning-paths/smartphones-and-mobile/Build-Llama3-Chat-Android-App-Using-Executorch-And-XNNPACK/3-Understanding-LLaMA-models.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ Llama models are powerful and versatile, having the ability to generate coherent
2222
* Virtual assistants.
2323
* Language translation.
2424

25-
Please note that the models are subject to the [acceptable use policy](https://github.com/facebookresearch/llama/blob/main/USE_POLICY.md) and this [responsible use guide](https://ai.meta.com/static-resource/responsible-use-guide/).
25+
Please note that the models are subject to the [acceptable use policy](https://github.com/facebookresearch/llama/blob/main/USE_POLICY.md) and [this responsible use guide](https://ai.meta.com/static-resource/responsible-use-guide/).
2626

2727
## Results
2828

@@ -43,7 +43,7 @@ The results are for two different groupsizes, with max_seq_len 2048, and 1000 sa
4343
|Llama 2 7B | 9.2 | 10.2 | 10.7
4444
|Llama 3 8B | 7.9 | 9.4 | 9.7
4545

46-
Note that groupsize less than 128 was not enabled, since such a model was still too large. This is because current efforts have focused on enabling FP32, and support for FP16 is under way.
46+
Note that groupsize less than 128 was not enabled in this example, since the model was still too large. This is because current efforts have focused on enabling FP32, and support for FP16 is under way.
4747

4848
What this implies for model size is:
4949

content/learning-paths/smartphones-and-mobile/Build-Llama3-Chat-Android-App-Using-Executorch-And-XNNPACK/4-Prepare-LLaMA-models.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ layout: learningpathall
88

99
## Download and export the Llama 3.2 1B model
1010

11-
To get started with Llama 3, you obtain the pre-trained parameters by visiting [Meta's Llama Downloads](https://llama.meta.com/llama-downloads/) page. Request the access by filling out your details and read through and accept the Responsible Use Guide. This grants you a license and a download link which is valid for 24 hours. The Llama 3.2 1B model is used for this part, but the same instructions apply for other options as well with minimal modification.
11+
To get started with Llama 3, you can obtain the pre-trained parameters by visiting [Meta's Llama Downloads](https://llama.meta.com/llama-downloads/) page. Request access by filling out your details, and read through and accept the Responsible Use Guide. This grants you a license and a download link which is valid for 24 hours. The Llama 3.2 1B model is used for this exercise, but the same instructions apply to other options as well with minimal modification.
1212

1313
Install the `llama-stack` package from `pip`.
1414
```bash

content/learning-paths/smartphones-and-mobile/Build-Llama3-Chat-Android-App-Using-Executorch-And-XNNPACK/5-Run-Benchmark-on-Android.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Cross-compile Llama runner to run on Android using the steps below.
1212

1313
### 1. Set Android NDK
1414

15-
Set the environment variable to point to the Android NDK.
15+
Set the environment variable to point to the Android NDK:
1616

1717
``` bash
1818
export ANDROID_NDK=$ANDROID_HOME/ndk/28.0.12433566/
@@ -52,7 +52,7 @@ cmake --build cmake-out-android -j7 --target install --config Release
5252
Make sure you add -DEXECUTORCH_XNNPACK_ENABLE_KLEIDI=ON option to enable support for KleidiAI kernels in ExecuTorch with XNNPack.
5353
{{% /notice %}}
5454

55-
### 3. Build Llama runner for android
55+
### 3. Build Llama runner for Android
5656

5757
Use `cmake` to cross-compile Llama runner:
5858

@@ -78,7 +78,7 @@ You should now have `llama_main` available for Android.
7878

7979
## Run on Android via adb shell
8080

81-
### 1. Connect your android phone
81+
### 1. Connect your Android phone
8282

8383
Connect your phone to your computer using a USB cable.
8484

@@ -122,4 +122,4 @@ I 00:00:09.624432 executorch:stats.h:154] Time to first generated token: 0.2020
122122
I 00:00:09.624434 executorch:stats.h:161] Sampling time over 127 tokens: 0.110000 (seconds)
123123
```
124124
125-
You have successfully run the llama 3.1 1B model on your Android smartphone with ExecuTorch using KleidiAI kernels.
125+
You have successfully run the Llama 3.1 1B model on your Android smartphone with ExecuTorch using KleidiAI kernels.

content/learning-paths/smartphones-and-mobile/Build-Llama3-Chat-Android-App-Using-Executorch-And-XNNPACK/6-Build-Android-Chat-App.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,14 @@ You can use the Android demo application included in ExecuTorch repository [Llam
2121
```
2222

2323
{{% notice Note %}}
24-
<path_to_android_ndk> is the root for the NDK, which is usually under ~/Library/Android/sdk/ndk/XX.Y.ZZZZZ for macOS, and contains NOTICE and README.md. Make sure you can confirm <path_to_android_ndk>/build/cmake/android.toolchain.cmake is available for CMake to cross-compile.
24+
<path_to_android_ndk> is the root for the NDK, which is usually under ~/Library/Android/sdk/ndk/XX.Y.ZZZZZ for macOS, and contains NOTICE and README.md.
25+
Make sure you can confirm <path_to_android_ndk>/build/cmake/android.toolchain.cmake is available for CMake to cross-compile.
2526
{{% /notice %}}
2627

27-
3. (Optional) If you need to use tiktoken as the tokenizer (for LLaMA 3), set `EXECUTORCH_USE_TIKTOKEN=ON` and CMake uses it as the tokenizer. If you run other models like LLaMA 2, skip this step.
28+
3. (Optional) If you need to use tiktoken as the tokenizer (for LLama 3), set `EXECUTORCH_USE_TIKTOKEN=ON`, and CMake uses it as the tokenizer. If you run other models such as LLama 2, skip this step.
2829

2930
``` bash
30-
export EXECUTORCH_USE_TIKTOKEN=ON # Only for LLaMA3
31+
export EXECUTORCH_USE_TIKTOKEN=ON # Only for LLama3
3132
```
3233

3334
4. Run the following commands to set up the required JNI library:
@@ -83,7 +84,7 @@ If the files are not on the device, use the device explorer to copy them.
8384
8485
This is the recommended option.
8586
86-
1. Open Android Studio and select Open an existing Android Studio project and navigate to open `examples/demo-apps/android/LlamaDemo`.
87+
1. Open Android Studio and select **Open an existing Android Studio project** and navigate to open `examples/demo-apps/android/LlamaDemo`.
8788
8889
2. Run the app (^R). This builds and launches the app on the phone.
8990

content/learning-paths/smartphones-and-mobile/Build-Llama3-Chat-Android-App-Using-Executorch-And-XNNPACK/_review.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ review:
66
answers:
77
- ExecuTorch is an end-to-end solution for enabling on-device inference capabilities across mobile and edge devices.
88
- It is a Pytorch method to quantize LLMs.
9-
- It is a program to execute pytorch models.
9+
- It is a program to execute PyTorch models.
1010
correct_answer: 1
1111
explanation: >
1212
ExecuTorch is part of the PyTorch Edge ecosystem and enables efficient deployment of PyTorch models to edge devices.
@@ -20,7 +20,7 @@ review:
2020
- Llama is a family of large language models that uses publicly-available data for training.
2121
correct_answer: 3
2222
explanation: >
23-
LLaMA is a state-of-the-art foundational large language model designed to enable researchers to advance their work in this subfield of AI.
23+
LLama is a state-of-the-art foundational large language model designed to enable researchers to advance their work in this subfield of AI.
2424
2525
- questions:
2626
question: >

0 commit comments

Comments
 (0)