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: content/learning-paths/mobile-graphics-and-gaming/build-llama3-chat-android-app-using-executorch-and-xnnpack/1-dev-env-setup.md
+72-24Lines changed: 72 additions & 24 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -13,61 +13,109 @@ In this Learning Path, you will learn how to build and deploy a simple LLM-based
13
13
The first step is to prepare a development environment with the required software:
14
14
15
15
- Android Studio (latest version recommended).
16
-
- Android NDK version 28.0.12433566.
16
+
- Android NDK version 28.0.12433566 or later.
17
17
- Java 17 JDK.
18
18
- Git.
19
19
- Python 3.10 or later (these instructions have been tested with 3.10 and 3.12).
20
20
21
21
The instructions assume macOS with Apple Silicon, an x86 Debian, or an Ubuntu Linux machine, with at least 16GB of RAM.
22
22
23
-
## Install Android Studio and Android NDK
23
+
## Install Java 17 JDK
24
+
25
+
Open the [Java SE 17 Archive Downloads](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) page in your browser.
26
+
27
+
Select an appropriate download for your development machine operating system.
24
28
25
-
Follow these steps to install and configure Android Studio:
29
+
Downloads are available for macOS as well as Linux.
26
30
27
-
1. Download and install the latest version of [Android Studio](https://developer.android.com/studio/).
31
+
## Install and configure Android Studio
28
32
29
-
2.Start Android Studio and open the **Settings** dialog.
33
+
Start by downloading and installing the latest version of Android Studio by navigating to the Downloads page:
30
34
31
-
3. Navigate to **Languages & Frameworks**, then **Android SDK**.
35
+
```
36
+
https://developer.android.com/studio/
37
+
```
32
38
33
-
4. In the **SDK Platforms** tab, check **Android 14.0 ("UpsideDownCake")**.
39
+
### For MacOS: Using UI
34
40
35
-
Next, install the specific version of the Android NDK that you require by first installing the Android command line tools:
41
+
Follow these steps to configure Android Studio:
36
42
37
-
Linux:
43
+
1. Start Android Studio and open the **Settings** dialog.
38
44
45
+
2. Navigate to **Languages & Frameworks**, then **Android SDK**.
46
+
47
+
3. In the **SDK Platforms** tab, check **Android 14.0 ("UpsideDownCake")**. Click **Apply** to install.
48
+
49
+
4. In the **SDK Tools** tab, check **NDK (Side by side)**. Click **Apply** to install.
The next step is to accept the license agreements. Press 'y', then 'Enter', as many times as prompted.
82
+
83
+
```bash
84
+
sdkmanager --licenses
53
85
```
54
86
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:
87
+
Finally, you can install the required Android SDK components:
Verify by checking that the NDK was installed in the same directory that Android Studio installed the SDK.
99
+
100
+
{{% notice Default Path %}}
101
+
On macOS, this is generally `~/Library/Android/sdk`, and on Linux, it's `~/Android/Sdk`. You should also update the command to use the installed NDK version.
102
+
{{% /notice %}}
103
+
104
+
```bash
105
+
ls $ANDROID_HOME
62
106
```
63
107
64
-
## Install Java 17 JDK
108
+
It should print the installed version, for example:
65
109
66
-
Open the [Java SE 17 Archive Downloads](https://www.oracle.com/java/technologies/javase/jdk17-archive-downloads.html) page in your browser.
110
+
```output
111
+
29.0.14206865
112
+
```
67
113
68
-
Select an appropriate download for your development machine operating system.
114
+
Set the required environment variable:
69
115
70
-
Downloads are available for macOS as well as Linux.
Copy file name to clipboardExpand all lines: content/learning-paths/mobile-graphics-and-gaming/build-llama3-chat-android-app-using-executorch-and-xnnpack/2-executorch-setup.md
+5-13Lines changed: 5 additions & 13 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,9 @@ ExecuTorch is an end-to-end solution for enabling on-device inference capabiliti
12
12
13
13
The best practice is to generate an isolated Python environment in which to install your ExecuTorch dependencies. We provide instructions for both a Python virtual environment and a Conda virtual environment, but you only need one.
14
14
15
-
### Option 1: Create a Python virtual environment
15
+
### Create a Python virtual environment
16
+
17
+
Use the `venv` module that is available through Python:
The prompt of your terminal has `executorch` as a prefix to indicate the virtual environment is active.
23
25
24
-
### Option 2: Create a Conda virtual environment
25
-
26
-
Install Miniconda on your development machine by following the [Installing conda](https://conda.io/projects/conda/en/latest/user-guide/install/index.html) instructions.
27
-
28
-
Once `conda` is installed, create the environment:
29
-
30
-
```bash
31
-
conda create -yn executorch-venv python=3.10.0
32
-
conda activate executorch-venv
33
-
```
34
-
35
26
### Clone ExecuTorch and install the required dependencies
36
27
37
-
From within the conda environment, run the commands below to download the ExecuTorch repository and install the required packages:
28
+
From within the virtual environment, run the commands below to download the ExecuTorch repository and install the required packages:
Copy file name to clipboardExpand all lines: content/learning-paths/mobile-graphics-and-gaming/build-llama3-chat-android-app-using-executorch-and-xnnpack/5-run-benchmark-on-android.md
+1-4Lines changed: 1 addition & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -32,6 +32,7 @@ Use `cmake` to cross-compile ExecuTorch:
Copy file name to clipboardExpand all lines: content/learning-paths/mobile-graphics-and-gaming/build-llama3-chat-android-app-using-executorch-and-xnnpack/6-build-android-chat-app.md
+15-20Lines changed: 15 additions & 20 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,17 +6,16 @@ weight: 7
6
6
layout: learningpathall
7
7
---
8
8
9
+
In this section, you will use a Android demo application to demonstrate local inference with ExecuTorch.
10
+
9
11
## Build the Android Archive (AAR)
10
-
{{% notice Note %}}
11
-
You can use the Android demo application included in ExecuTorch repository [LlamaDemo](https://github.com/pytorch/executorch/tree/main/examples/demo-apps/android/LlamaDemo) to demonstrate local inference with ExecuTorch.
12
-
{{% /notice %}}
13
12
14
13
1. Open a terminal window and navigate to the root directory of the `executorch` repository.
15
14
16
-
2.Set the following environment variables:
15
+
2.If you haven't already, set the following environment variables:
1. Open Android Studio and select **Open an existing Android Studio project** and navigate to open `examples/demo-apps/android/LlamaDemo`.
77
+
1. Open Android Studio and select **Open an existing Android Studio project** and navigate to open `executorch-examples/llm/android/LlamaDemo`.
82
78
83
79
2. Run the app (^R). This builds and launches the app on the phone.
84
80
85
81
### Option 2: Command line
86
82
87
-
Without Android Studio UI, you can run gradle directly to build the app. You need to set up the Android SDK path and invoke gradle.
83
+
Without Android Studio UI, you can run gradle directly to build the app. You need to set up the Android SDK path and invoke gradle. Navigate to the newly cloned `executorch-examples` repository.
0 commit comments