From cf9f3ba45f28fa4b598b0808a30e45cb20f0787a Mon Sep 17 00:00:00 2001 From: Mergen Nachin Date: Thu, 24 Apr 2025 11:58:52 -0400 Subject: [PATCH] Update iOS doc to point to examples README --- .ci/scripts/test_ios_ci.sh | 2 +- backends/apple/mps/setup.md | 2 +- docs/source/backends-mps.md | 2 +- docs/source/demo-apps-ios.md | 135 ------------------ docs/source/index.md | 4 +- .../using-executorch-building-from-source.md | 4 +- 6 files changed, 7 insertions(+), 142 deletions(-) delete mode 100644 docs/source/demo-apps-ios.md diff --git a/.ci/scripts/test_ios_ci.sh b/.ci/scripts/test_ios_ci.sh index e87dbec8444..16f2e16de50 100755 --- a/.ci/scripts/test_ios_ci.sh +++ b/.ci/scripts/test_ios_ci.sh @@ -7,7 +7,7 @@ set -e -APP_PATH="executorch-examples/apple/ExecuTorchDemo/ExecuTorchDemo" +APP_PATH="executorch-examples/mv3/apple/ExecuTorchDemo/ExecuTorchDemo" MODEL_NAME="mv3" SIMULATOR_NAME="executorch" diff --git a/backends/apple/mps/setup.md b/backends/apple/mps/setup.md index bd688fe8b78..6cedd994faa 100644 --- a/backends/apple/mps/setup.md +++ b/backends/apple/mps/setup.md @@ -15,7 +15,7 @@ The MPS backend device maps machine learning computational graphs and primitives * [Introduction to ExecuTorch](../../../docs/source/intro-how-it-works.md) * [Setting up ExecuTorch](../../../docs/source/getting-started-setup.rst) * [Building ExecuTorch with CMake](../../../docs/source/using-executorch-cpp.md#building-with-cmake) -* [ExecuTorch iOS Demo App](../../../docs/source/demo-apps-ios.md) +* [ExecuTorch iOS Demo App](https://github.com/pytorch-labs/executorch-examples/tree/main/mv3/apple/ExecuTorchDemo) * [ExecuTorch iOS LLaMA Demo App](../../../docs/source/llm/llama-demo-ios.md) ::: :::: diff --git a/docs/source/backends-mps.md b/docs/source/backends-mps.md index 4d5c445349d..5be3dc72403 100644 --- a/docs/source/backends-mps.md +++ b/docs/source/backends-mps.md @@ -15,7 +15,7 @@ The MPS backend device maps machine learning computational graphs and primitives * [Introduction to ExecuTorch](intro-how-it-works.md) * [Getting Started](getting-started.md) * [Building ExecuTorch with CMake](using-executorch-building-from-source.md) -* [ExecuTorch iOS Demo App](demo-apps-ios.md) +* [ExecuTorch iOS Demo App](https://github.com/pytorch-labs/executorch-examples/tree/main/mv3/apple/ExecuTorchDemo) * [ExecuTorch iOS LLaMA Demo App](llm/llama-demo-ios.md) ::: :::: diff --git a/docs/source/demo-apps-ios.md b/docs/source/demo-apps-ios.md deleted file mode 100644 index e85f820d753..00000000000 --- a/docs/source/demo-apps-ios.md +++ /dev/null @@ -1,135 +0,0 @@ -# Building an ExecuTorch iOS Demo App - -Welcome to the tutorial on setting up the ExecuTorch iOS Demo App! - -This app uses the -[MobileNet v3](https://pytorch.org/vision/main/models/mobilenetv3.html) model to -process live camera images leveraging three different backends: -[XNNPACK](https://github.com/google/XNNPACK), -[Core ML](https://developer.apple.com/documentation/coreml) and -[Metal Performance Shaders (MPS)](https://developer.apple.com/documentation/metalperformanceshaders) -(Xcode 15+ and iOS 17+ only). - -

- -

- -## Prerequisites - -Before we start, make sure you have the following tools installed: - -### 1. Xcode 15 and Command Line Tools - -Install Xcode 15 from the -[Mac App Store](https://apps.apple.com/app/xcode/id497799835) and then install -the Command Line Tools using the terminal: - -```bash -xcode-select --install -``` - -### 2. Python 3.10+ - -Python 3.10 or above, along with `pip`, should be pre-installed on MacOS 13.5+. -If needed, [download Python](https://www.python.org/downloads/macos/) and -install it. Verify the Python and pip versions using these commands: - -```bash -which python3 pip -python3 --version -pip --version -``` - -### 3. Set Up ExecuTorch - -Clone ExecuTorch and set up the environment as explained in the [Building from Source](using-executorch-building-from-source.md) tutorial: - -```bash -git clone -b viable/strict https://github.com/pytorch/executorch.git && cd executorch - -python3 -m venv .venv && source .venv/bin/activate && pip install --upgrade pip - -./install_executorch.sh -``` - -### 4. Backend Dependencies - -Install additional dependencies for [Core ML](backends-coreml.md) and [MPS](backends-mps.md) backends: - -```bash -./backends/apple/coreml/scripts/install_requirements.sh -./backends/apple/mps/install_requirements.sh -``` - -### 5. Clone the Demo App - -```bash -git clone --depth 1 https://github.com/pytorch-labs/executorch-examples.git -``` - -## Models and Labels - -Now, let's move on to exporting and bundling the MobileNet v3 model. - -### 1. Export Model - -Export the MobileNet v3 model with Core ML, MPS and XNNPACK backends, and move -the exported model to a specific location where the Demo App will pick them up: - -```bash -MODEL_NAME="mv3" - -python3 -m examples.portable.scripts.export --model_name="$MODEL_NAME" -python3 -m examples.apple.coreml.scripts.export --model_name="$MODEL_NAME" -python3 -m examples.apple.mps.scripts.mps_example --model_name="$MODEL_NAME" -python3 -m examples.xnnpack.aot_compiler --model_name="$MODEL_NAME" --delegate - -APP_PATH="executorch-examples/apple/ExecuTorchDemo/ExecuTorchDemo" - -mkdir -p "$APP_PATH/Resources/Models/MobileNet/" -mv $MODEL_NAME*.pte "$APP_PATH/Resources/Models/MobileNet/" -``` - -### 2. Download Labels - -Download the MobileNet model labels required for image classification: - -```bash -curl https://raw.githubusercontent.com/pytorch/hub/master/imagenet_classes.txt \ - -o "$APP_PATH/Resources/Models/MobileNet/imagenet_classes.txt" -``` - -## Build and Run the App - -We're almost done! Now, we just need to open the project in Xcode, run the tests, and finally run the app. - -### 1. Open Project in Xcode - -Double-click on the project file under `executorch-examples/apple/ExecuTorchDemo` or run the command: - -```bash -open $APP_PATH.xcodeproj -``` - -### 2. Run Tests - -You can run tests on Simulaltor directly in Xcode with `Cmd + U` or use the command line: - -```bash -xcrun simctl create executorch "iPhone 15" -xcodebuild clean test \ - -project $APP_PATH.xcodeproj \ - -scheme App \ - -destination name=executorch -xcrun simctl delete executorch -``` - -### 3. Run App - -Finally, connect the device, set up Code Signing in Xcode, and then run the app -using `Cmd + R`. Try installing a Release build for better performance. - -Congratulations! You've successfully set up the ExecuTorch iOS Demo App. Now, -you can explore and enjoy the power of ExecuTorch on your iOS device! - -Learn more about [Using ExecuTorch on iOS](using-executorch-ios.md). diff --git a/docs/source/index.md b/docs/source/index.md index d6d26ad72d5..49a51d4e557 100644 --- a/docs/source/index.md +++ b/docs/source/index.md @@ -42,7 +42,7 @@ ExecuTorch provides support for: - [FAQs](using-executorch-faqs) #### Examples - [Android Demo Apps](https://github.com/pytorch-labs/executorch-examples/tree/main/dl3/android/DeepLabV3Demo#executorch-android-demo-app) -- [iOS Demo Apps](demo-apps-ios.md) +- [iOS Demo Apps](https://github.com/pytorch-labs/executorch-examples/tree/main/mv3/apple/ExecuTorchDemo) - [Hugging Face Models](https://github.com/huggingface/optimum-executorch/blob/main/README.md) #### Backends - [Overview](backends-overview) @@ -144,7 +144,7 @@ using-executorch-faqs :hidden: Building an ExecuTorch Android Demo App -demo-apps-ios.md +Building an ExecuTorch iOS Demo App tutorial-arm-ethos-u.md ``` diff --git a/docs/source/using-executorch-building-from-source.md b/docs/source/using-executorch-building-from-source.md index b5b8d3d4261..e2657e69b55 100644 --- a/docs/source/using-executorch-building-from-source.md +++ b/docs/source/using-executorch-building-from-source.md @@ -284,7 +284,7 @@ Note, some backends may require additional dependencies and certain versions of 3. Copy over the generated `.xcframework` bundles to your Xcode project, link them against your targets and don't forget to add an extra linker flag `-all_load`. -Check out the [iOS Demo App](demo-apps-ios.md) tutorial for more info. +Check out the [iOS Demo App](https://github.com/pytorch-labs/executorch-examples/tree/main/mv3/apple/ExecuTorchDemo) tutorial for more info. ## Next steps @@ -292,5 +292,5 @@ Check out the [iOS Demo App](demo-apps-ios.md) tutorial for more info. 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: * [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. -* 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. +* Tutorials on building [Android](https://github.com/pytorch-labs/executorch-examples/tree/main/dl3/android/DeepLabV3Demo#executorch-android-demo-app) and [iOS](https://github.com/pytorch-labs/executorch-examples/tree/main/mv3/apple/ExecuTorchDemo) demo apps. * 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).