Skip to content

Commit 2d01dfc

Browse files
authored
Improve android related docs
For android demo, use links in pytorch-labs/executorch-examples Remove references to old demo app Add video
1 parent 399a255 commit 2d01dfc

8 files changed

+33
-13
lines changed
139 KB
Loading
1.92 MB
Binary file not shown.

docs/source/backend-delegates-xnnpack-reference.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -142,5 +142,5 @@ def _qdq_quantized_linear(
142142
You can read more indepth explanations on PyTorch 2 quantization [here](https://pytorch.org/tutorials/prototype/pt2e_quant_ptq.html).
143143

144144
## See Also
145-
- [Integrating XNNPACK Delegate Android App](demo-apps-android.md)
145+
- [Integrating XNNPACK Delegate in Android AAR](using-executorch-android.md)
146146
- [Complete the Lowering to XNNPACK Tutorial](tutorial-xnnpack-delegate-lowering.md)

docs/source/backends-qualcomm.md

-5
Original file line numberDiff line numberDiff line change
@@ -351,11 +351,6 @@ The command-line arguments are written in [utils.py](https://github.com/pytorch/
351351
The model, inputs, and output location are passed to `qnn_executorch_runner` by `--model_path`, `--input_list_path`, and `--output_folder_path`.
352352

353353

354-
### Running a model via ExecuTorch's android demo-app
355-
356-
An Android demo-app using Qualcomm AI Engine Direct Backend can be found in
357-
`examples`. Please refer to android demo app [tutorial](demo-apps-android.md).
358-
359354
## Supported model list
360355

361356
Please refer to `$EXECUTORCH_ROOT/examples/qualcomm/scripts/` and `EXECUTORCH_ROOT/examples/qualcomm/oss_scripts/` to the list of supported models.

docs/source/index.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ ExecuTorch provides support for:
4141
- [Building from Source](using-executorch-building-from-source)
4242
- [FAQs](using-executorch-faqs)
4343
#### Examples
44-
- [Android Demo Apps](demo-apps-android.md)
44+
- [Android Demo Apps](https://github.com/pytorch-labs/executorch-examples/tree/main/dl3/android/DeepLabV3Demo#executorch-android-demo-app)
4545
- [iOS Demo Apps](demo-apps-ios.md)
4646
#### Backends
4747
- [Overview](backends-overview)
@@ -142,7 +142,7 @@ using-executorch-faqs
142142
:caption: Examples
143143
:hidden:
144144
145-
demo-apps-android.md
145+
Building an ExecuTorch Android Demo App <https://github.com/pytorch-labs/executorch-examples/tree/main/dl3/android/DeepLabV3Demo#executorch-android-demo-app>
146146
demo-apps-ios.md
147147
```
148148

docs/source/tutorial-xnnpack-delegate-lowering.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ Now you should be able to find the executable built at `./cmake-out/backends/xnn
176176
```
177177

178178
## Building and Linking with the XNNPACK Backend
179-
You can build the XNNPACK backend [CMake target](https://github.com/pytorch/executorch/blob/main/backends/xnnpack/CMakeLists.txt#L83), and link it with your application binary such as an Android or iOS application. For more information on this you may take a look at this [resource](demo-apps-android.md) next.
179+
You can build the XNNPACK backend [CMake target](https://github.com/pytorch/executorch/blob/main/backends/xnnpack/CMakeLists.txt#L83), and link it with your application binary such as an Android or iOS application. For more information on this you may take a look at this [resource](./using-executorch-android.md) next.
180180

181181
## Profiling
182182
To enable profiling in the `xnn_executor_runner` pass the flags `-DEXECUTORCH_ENABLE_EVENT_TRACER=ON` and `-DEXECUTORCH_BUILD_DEVTOOLS=ON` to the build command (add `-DENABLE_XNNPACK_PROFILING=ON` for additional details). This will enable ETDump generation when running the inference and enables command line flags for profiling (see `xnn_executor_runner --help` for details).

docs/source/using-executorch-android.md

+9
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ The AAR artifact contains the Java library for users to integrate with their Jav
2222
- LLaMa-specific Custom ops library.
2323
- Comes with two ABI variants, arm64-v8a and x86\_64.
2424

25+
The AAR library can be used for generic Android device with arm64-v8a or x86_64 architecture. It can be used across form factors, including phones, tablets, tv boxes, etc, as it does not contain any UI components.
26+
2527
## Using AAR from Maven Central
2628

2729
ExecuTorch is available on [Maven Central](https://mvnrepository.com/artifact/org.pytorch/executorch-android).
@@ -38,6 +40,11 @@ dependencies {
3840

3941
Note: `org.pytorch:executorch-android:0.5.1` corresponds to executorch v0.5.0.
4042

43+
Click the screenshot below to watch the *demo video* on how to add the package and run a simple ExecuTorch model with Android Studio.
44+
<a href="https://pytorch.org/executorch/main/_static/img/android_studio.mp4">
45+
<img src="https://pytorch.org/executorch/main/_static/img/android_studio.jpeg" width="800" alt="Integrating and Running ExecuTorch on Android">
46+
</a>
47+
4148
## Using AAR file directly
4249

4350
You can also directly specify an AAR file in the app. We upload pre-built AAR to S3 during each release, or as a snapshot.
@@ -103,6 +110,8 @@ export ANDROID_NDK=/path/to/ndk
103110
sh scripts/build_android_library.sh
104111
```
105112

113+
Currently, XNNPACK backend is always built with the script.
114+
106115
### Optional environment variables
107116

108117
Optionally, set these environment variables before running `build_android_library.sh`.

docs/source/using-executorch-building-from-source.md

+20-4
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ portability details.
6767
./install_executorch.sh
6868
```
6969

70-
Use the [`--pybind` flag](https://github.com/pytorch/executorch/blob/main/install_executorch.sh#L26-L29) to install with pybindings and dependencies for other backends.
70+
Use the [`--pybind` flag](https://github.com/pytorch/executorch/blob/main/install_executorch.sh#L26-L29) to install with pybindings and dependencies for other backends.
7171
```bash
7272
./install_executorch.sh --pybind <coreml | mps | xnnpack>
7373

@@ -86,7 +86,7 @@ portability details.
8686
For development mode, run the command with `--editable`, which allows us to modify Python source code and see changes reflected immediately.
8787
```bash
8888
./install_executorch.sh --editable [--pybind xnnpack]
89-
89+
9090
# Or you can directly do the following if dependencies are already installed
9191
# either via a previous invocation of `./install_executorch.sh` or by explicitly installing requirements via `./install_requirements.sh` first.
9292
pip install -e .
@@ -200,7 +200,7 @@ I 00:00:00.000612 executorch:executor_runner.cpp:138] Setting up planned buffer
200200
I 00:00:00.000669 executorch:executor_runner.cpp:161] Method loaded.
201201
I 00:00:00.000685 executorch:executor_runner.cpp:171] Inputs prepared.
202202
I 00:00:00.000764 executorch:executor_runner.cpp:180] Model executed successfully.
203-
I 00:00:00.000770 executorch:executor_runner.cpp:184] 1 outputs:
203+
I 00:00:00.000770 executorch:executor_runner.cpp:184] 1 outputs:
204204
Output 0: tensor(sizes=[1], [2.])
205205
```
206206

@@ -210,6 +210,8 @@ Output 0: tensor(sizes=[1], [2.])
210210
Following are instruction on how to perform cross compilation for Android and iOS.
211211

212212
### Android
213+
214+
#### Building executor_runner shell binary
213215
- Prerequisite: [Android NDK](https://developer.android.com/ndk), choose one of the following:
214216
- Option 1: Download Android Studio by following the instructions to [install ndk](https://developer.android.com/studio/projects/install-ndk).
215217
- Option 2: Download Android NDK directly from [here](https://developer.android.com/ndk/downloads).
@@ -235,6 +237,20 @@ adb push add.pte /data/local/tmp/executorch
235237
adb shell "/data/local/tmp/executorch/executor_runner --model_path /data/local/tmp/executorch/add.pte"
236238
```
237239

240+
#### Building AAR for app integration from source
241+
- Prerequisite: Android NDK from the previous section, and Android SDK (Android Studio is recommended).
242+
243+
Assuming Android NDK and SDK is available, run:
244+
```bash
245+
export ANDROID_ABIS=arm64-v8a
246+
export BUILD_AAR_DIR=aar-out
247+
mkdir -p $BUILD_AAR_DIR
248+
sh scripts/build_android_library.sh
249+
```
250+
251+
This script will build the AAR, which contains the Java API and its corresponding JNI library. Please see
252+
[this documentation](./using-executorch-android#using-aar-file) for usage.
253+
238254
### iOS
239255

240256
For iOS we'll build [frameworks](https://developer.apple.com/documentation/xcode/creating-a-multi-platform-binary-framework-bundle) instead of static libraries, that will also contain the public headers inside.
@@ -268,5 +284,5 @@ Check out the [iOS Demo App](demo-apps-ios.md) tutorial for more info.
268284
You have successfully cross-compiled `executor_runner` binary to iOS and Android platforms. You can start exploring advanced features and capabilities. Here is a list of sections you might want to read next:
269285

270286
* [Selective build](kernel-library-selective-build.md) to build the runtime that links to only kernels used by the program, which can provide significant binary size savings.
271-
* Tutorials on building [Android](./demo-apps-android.md) and [iOS](./demo-apps-ios.md) demo apps.
287+
* Tutorials on building [Android](https://github.com/pytorch-labs/executorch-examples/tree/main/dl3/android/DeepLabV3Demo#executorch-android-demo-app) and [iOS](./demo-apps-ios.md) demo apps.
272288
* Tutorials on deploying applications to embedded devices such as [ARM Cortex-M/Ethos-U](backends-arm-ethos-u.md) and [XTensa HiFi DSP](./backends-cadence.md).

0 commit comments

Comments
 (0)