diff --git a/examples/demo-apps/apple_ios/LLaMA/docs/screenshots/ios_demo_app.jpg b/docs/source/_static/img/ios_demo_app.jpg
similarity index 100%
rename from examples/demo-apps/apple_ios/LLaMA/docs/screenshots/ios_demo_app.jpg
rename to docs/source/_static/img/ios_demo_app.jpg
diff --git a/examples/demo-apps/apple_ios/LLaMA/docs/screenshots/ios_demo_app_choosing_package.png b/docs/source/_static/img/ios_demo_app_choosing_package.png
similarity index 100%
rename from examples/demo-apps/apple_ios/LLaMA/docs/screenshots/ios_demo_app_choosing_package.png
rename to docs/source/_static/img/ios_demo_app_choosing_package.png
diff --git a/examples/demo-apps/apple_ios/LLaMA/docs/screenshots/ios_demo_app_llava.jpg b/docs/source/_static/img/ios_demo_app_llava.jpg
similarity index 100%
rename from examples/demo-apps/apple_ios/LLaMA/docs/screenshots/ios_demo_app_llava.jpg
rename to docs/source/_static/img/ios_demo_app_llava.jpg
diff --git a/examples/demo-apps/apple_ios/LLaMA/docs/screenshots/ios_demo_app_mps.jpg b/docs/source/_static/img/ios_demo_app_mps.jpg
similarity index 100%
rename from examples/demo-apps/apple_ios/LLaMA/docs/screenshots/ios_demo_app_mps.jpg
rename to docs/source/_static/img/ios_demo_app_mps.jpg
diff --git a/examples/demo-apps/apple_ios/LLaMA/docs/screenshots/ios_demo_app_swift_pm.png b/docs/source/_static/img/ios_demo_app_swift_pm.png
similarity index 100%
rename from examples/demo-apps/apple_ios/LLaMA/docs/screenshots/ios_demo_app_swift_pm.png
rename to docs/source/_static/img/ios_demo_app_swift_pm.png
diff --git a/docs/source/index.rst b/docs/source/index.rst
index 7379c35bd29..d49fd43e31b 100644
--- a/docs/source/index.rst
+++ b/docs/source/index.rst
@@ -117,6 +117,9 @@ Topics in this section will help you get started with ExecuTorch.
:hidden:
llm/getting-started
+ llm/llama-demo-android
+ llm/build-run-llama3-qualcomm-ai-engine-direct-backend
+ llm/llama-demo-ios
.. toctree::
:glob:
diff --git a/docs/source/llm/llama-demo-android.md b/docs/source/llm/llama-demo-android.md
index ce2d25a4a89..023f82baf33 100644
--- a/docs/source/llm/llama-demo-android.md
+++ b/docs/source/llm/llama-demo-android.md
@@ -1,141 +1,2 @@
-# ExecuTorch Llama Android Demo App
-
-We’re excited to share that the newly revamped Android demo app is live and includes many new updates to provide a more intuitive and smoother user experience with a chat use case! The primary goal of this app is to showcase how easily ExecuTorch can be integrated into an Android demo app and how to exercise the many features ExecuTorch and Llama models have to offer.
-
-This app serves as a valuable resource to inspire your creativity and provide foundational code that you can customize and adapt for your particular use case.
-
-Please dive in and start exploring our demo app today! We look forward to any feedback and are excited to see your innovative ideas.
-
-
-## Key Concepts
-From this demo app, you will learn many key concepts such as:
-* How to prepare Llama models, build the ExecuTorch library, and model inferencing across delegates
-* Expose the ExecuTorch library via JNI layer
-* Familiarity with current ExecuTorch app-facing capabilities
-
-The goal is for you to see the type of support ExecuTorch provides and feel comfortable with leveraging it for your use cases.
-
-## Supporting Models
-As a whole, the models that this app supports are (varies by delegate):
-* Llama 3.1 8B
-* Llama 3 8B
-* Llama 2 7B
-* LLaVA-1.5 vision model (only XNNPACK)
-
-
-## Building the APK
-First it’s important to note that currently ExecuTorch provides support across 3 delegates. Once you identify the delegate of your choice, select the README link to get a complete end-to-end instructions for environment set-up to exporting the models to build ExecuTorch libraries and apps to run on device:
-
-| Delegate | Resource |
-| ------------- | ------------- |
-| XNNPACK (CPU-based library) | [link](docs/delegates/xnnpack_README.md) |
-| QNN (Qualcomm AI Accelerators) | [link](docs/delegates/qualcomm_README.md) |
-| MediaTek (MediaTek AI Accelerators) | [link](docs/delegates/mediatek_README.md) |
-
-## How to Use the App
-
-This section will provide the main steps to use the app, along with a code snippet of the ExecuTorch API.
-
-For loading the app, development, and running on device we recommend Android Studio:
-1. Open Android Studio and select "Open an existing Android Studio project" to open examples/demo-apps/android/LlamaDemo.
-2. Run the app (^R). This builds and launches the app on the phone.
-
-### Opening the App
-
-Below are the UI features for the app.
-
-Select the settings widget to get started with picking a model, its parameters and any prompts.
-
-
-
-
-
-
-### Select Models and Parameters
-
-Once you've selected the model, tokenizer, and model type you are ready to click on "Load Model" to have the app load the model and go back to the main Chat activity.
-
-
-
-
-
-
-Optional Parameters:
-* Temperature: Defaulted to 0, you can adjust the temperature for the model as well. The model will reload upon any adjustments.
-* System Prompt: Without any formatting, you can enter in a system prompt. For example, "you are a travel assistant" or "give me a response in a few sentences".
-* User Prompt: More for the advanced user, if you would like to manually input a prompt then you can do so by modifying the `{{user prompt}}`. You can also modify the special tokens as well. Once changed then go back to the main Chat activity to send.
-
-> [!TIP]
-> Helpful ExecuTorch API in app
-
-```java
-// Upon returning to the Main Chat Activity
-mModule = new LlamaModule(
- ModelUtils.getModelCategory(mCurrentSettingsFields.getModelType()),
- modelPath,
- tokenizerPath,
- temperature);
-int loadResult = mModule.load();
+```{include} ../../../examples/demo-apps/android/LlamaDemo/README.md
```
-
-* `modelCategory`: Indicate whether it’s a text-only or vision model
-* `modePath`: path to the .pte file
-* `tokenizerPath`: path to the tokenizer .bin file
-* `temperature`: model parameter to adjust the randomness of the model’s output
-
-
-### User Prompt
-Once model is successfully loaded then enter any prompt and click the send (i.e. generate) button to send it to the model.
-
-
-
-
-You can provide it more follow-up questions as well.
-
-
-
-
-> [!TIP]
-> Helpful ExecuTorch API in app
-```java
-mModule.generate(prompt,sequence_length, MainActivity.this);
-```
-* `prompt`: User formatted prompt
-* `sequence_length`: Number of tokens to generate in response to a prompt
-* `MainActivity.this`: Indicate that the callback functions (OnResult(), OnStats()) are present in this class.
-
-[*LLaVA-1.5: Only for XNNPACK delegate*]
-
-For LLaVA-1.5 implementation, select the exported LLaVA .pte and tokenizer file in the Settings menu and load the model. After this you can send an image from your gallery or take a live picture along with a text prompt to the model.
-
-
-
-
-
-
-### Output Generated
-To show completion of the follow-up question, here is the complete detailed response from the model.
-
-
-
-
-> [!TIP]
-> Helpful ExecuTorch API in app
-
-Ensure you have the following functions in your callback class that you provided in the `mModule.generate()`. For this example, it is `MainActivity.this`.
-```java
- @Override
- public void onResult(String result) {
- //...result contains token from response
- //.. onResult will continue to be invoked until response is complete
- }
-
- @Override
- public void onStats(float tps) {
- //...tps (tokens per second) stats is provided by framework
- }
-
-```
-
-## Reporting Issues
-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).
diff --git a/examples/demo-apps/android/LlamaDemo/README.md b/examples/demo-apps/android/LlamaDemo/README.md
index 1d4dc6d5769..397d677a5b7 100644
--- a/examples/demo-apps/android/LlamaDemo/README.md
+++ b/examples/demo-apps/android/LlamaDemo/README.md
@@ -28,9 +28,9 @@ First it’s important to note that currently ExecuTorch provides support across
| Delegate | Resource |
| ------------- | ------------- |
-| XNNPACK (CPU-based library) | [link](docs/delegates/xnnpack_README.md) |
-| QNN (Qualcomm AI Accelerators) | [link](docs/delegates/qualcomm_README.md) |
-| MediaTek (MediaTek AI Accelerators) | [link](docs/delegates/mediatek_README.md) |
+| XNNPACK (CPU-based library) | [link](https://github.com/pytorch/executorch/blob/main/examples/demo-apps/android/LlamaDemo/docs/delegates/xnnpack_README.md) |
+| QNN (Qualcomm AI Accelerators) | [link](https://github.com/pytorch/executorch/blob/main/examples/demo-apps/android/LlamaDemo/docs/delegates/qualcomm_README.md) |
+| MediaTek (MediaTek AI Accelerators) | [link](https://github.com/pytorch/executorch/blob/main/examples/demo-apps/android/LlamaDemo/docs/delegates/mediatek_README.md) |
## How to Use the App
@@ -46,7 +46,7 @@ Below are the UI features for the app.
Select the settings widget to get started with picking a model, its parameters and any prompts.
-
+
@@ -55,7 +55,7 @@ Select the settings widget to get started with picking a model, its parameters a
Once you've selected the model, tokenizer, and model type you are ready to click on "Load Model" to have the app load the model and go back to the main Chat activity.
-
+
@@ -87,12 +87,12 @@ int loadResult = mModule.load();
### User Prompt
Once model is successfully loaded then enter any prompt and click the send (i.e. generate) button to send it to the model.
-
+
You can provide it more follow-up questions as well.
-
+
> [!TIP]
@@ -109,14 +109,14 @@ mModule.generate(prompt,sequence_length, MainActivity.this);
For LLaVA-1.5 implementation, select the exported LLaVA .pte and tokenizer file in the Settings menu and load the model. After this you can send an image from your gallery or take a live picture along with a text prompt to the model.
-
+
### Output Generated
To show completion of the follow-up question, here is the complete detailed response from the model.
-
+
> [!TIP]
diff --git a/examples/demo-apps/android/LlamaDemo/docs/screenshots/chat.png b/examples/demo-apps/android/LlamaDemo/docs/screenshots/chat.png
deleted file mode 100644
index e7ed934519d..00000000000
Binary files a/examples/demo-apps/android/LlamaDemo/docs/screenshots/chat.png and /dev/null differ
diff --git a/examples/demo-apps/android/LlamaDemo/docs/screenshots/chat_response.png b/examples/demo-apps/android/LlamaDemo/docs/screenshots/chat_response.png
deleted file mode 100644
index 714265276fe..00000000000
Binary files a/examples/demo-apps/android/LlamaDemo/docs/screenshots/chat_response.png and /dev/null differ
diff --git a/examples/demo-apps/android/LlamaDemo/docs/screenshots/llava_example.png b/examples/demo-apps/android/LlamaDemo/docs/screenshots/llava_example.png
deleted file mode 100644
index ccac335ee65..00000000000
Binary files a/examples/demo-apps/android/LlamaDemo/docs/screenshots/llava_example.png and /dev/null differ
diff --git a/examples/demo-apps/android/LlamaDemo/docs/screenshots/load_complete_and_start_prompt.png b/examples/demo-apps/android/LlamaDemo/docs/screenshots/load_complete_and_start_prompt.png
deleted file mode 100644
index 43d81f10d00..00000000000
Binary files a/examples/demo-apps/android/LlamaDemo/docs/screenshots/load_complete_and_start_prompt.png and /dev/null differ
diff --git a/examples/demo-apps/android/LlamaDemo/docs/screenshots/logs.png b/examples/demo-apps/android/LlamaDemo/docs/screenshots/logs.png
deleted file mode 100644
index e35227a1c0c..00000000000
Binary files a/examples/demo-apps/android/LlamaDemo/docs/screenshots/logs.png and /dev/null differ
diff --git a/examples/demo-apps/android/LlamaDemo/docs/screenshots/mtk_changes_to_shell_file.png b/examples/demo-apps/android/LlamaDemo/docs/screenshots/mtk_changes_to_shell_file.png
deleted file mode 100644
index 7fa4e461863..00000000000
Binary files a/examples/demo-apps/android/LlamaDemo/docs/screenshots/mtk_changes_to_shell_file.png and /dev/null differ
diff --git a/examples/demo-apps/android/LlamaDemo/docs/screenshots/mtk_output.png b/examples/demo-apps/android/LlamaDemo/docs/screenshots/mtk_output.png
deleted file mode 100644
index e41d54c3561..00000000000
Binary files a/examples/demo-apps/android/LlamaDemo/docs/screenshots/mtk_output.png and /dev/null differ
diff --git a/examples/demo-apps/android/LlamaDemo/docs/screenshots/opening_the_app_details.png b/examples/demo-apps/android/LlamaDemo/docs/screenshots/opening_the_app_details.png
deleted file mode 100644
index 60494ecc69d..00000000000
Binary files a/examples/demo-apps/android/LlamaDemo/docs/screenshots/opening_the_app_details.png and /dev/null differ
diff --git a/examples/demo-apps/android/LlamaDemo/docs/screenshots/settings_menu.png b/examples/demo-apps/android/LlamaDemo/docs/screenshots/settings_menu.png
deleted file mode 100644
index 028e6b55cd7..00000000000
Binary files a/examples/demo-apps/android/LlamaDemo/docs/screenshots/settings_menu.png and /dev/null differ
diff --git a/examples/demo-apps/apple_ios/LLaMA/README.md b/examples/demo-apps/apple_ios/LLaMA/README.md
index af91239124e..a2316fd437e 100644
--- a/examples/demo-apps/apple_ios/LLaMA/README.md
+++ b/examples/demo-apps/apple_ios/LLaMA/README.md
@@ -27,8 +27,8 @@ First it’s important to note that currently ExecuTorch provides support across
| Delegate | Resource |
| ------------------------------ | --------------------------------- |
-| XNNPACK (CPU-based library) | [link](docs/delegates/xnnpack_README.md)|
-| MPS (Metal Performance Shader) | [link](docs/delegates/mps_README.md) |
+| XNNPACK (CPU-based library) | [link](https://github.com/pytorch/executorch/blob/main/examples/demo-apps/apple_ios/LLaMA/docs/delegates/xnnpack_README.md)|
+| MPS (Metal Performance Shader) | [link](https://github.com/pytorch/executorch/blob/main/examples/demo-apps/apple_ios/LLaMA/docs/delegates/mps_README.md) |
## How to Use the App
This section will provide the main steps to use the app, along with a code snippet of the ExecuTorch API.
@@ -58,11 +58,11 @@ For more details integrating and Running ExecuTorch on Apple Platforms, checkout
* Ensure that the ExecuTorch package dependencies are installed correctly, then select which ExecuTorch framework should link against which target.
-
+
-
+
* Run the app. This builds and launches the app on the phone.
@@ -82,13 +82,13 @@ For more details integrating and Running ExecuTorch on Apple Platforms, checkout
If the app successfully run on your device, you should see something like below:
-
+
For Llava 1.5 models, you can select and image (via image/camera selector button) before typing prompt and send button.
-
+
## Reporting Issues