|
3 | 3 | Check out the [tutorial](https://pytorch.org/executorch/main/llm/llama-demo-ios.html) on how to build the iOS demo app running your
|
4 | 4 | PyTorch models with [ExecuTorch](https://github.com/pytorch/executorch).
|
5 | 5 |
|
6 |
| -Once you can run the app on you device, |
7 |
| -1 - connect the device to you Mac, |
8 |
| -2 - copy the model and tokenizer.bin to the iOS Llama app |
9 |
| -3 - select the tokenizer and model with the `(...)` control (bottom left of screen, to the left of the text entrybox) |
| 6 | +``` |
| 7 | +git clone https://github.com/pytorch/executorch.git |
10 | 8 |
|
| 9 | +cd executorch |
11 | 10 |
|
12 |
| -Detailed step by step in conjunction with ExecuTorch iOS build, to run on |
13 |
| -simulator for iOS. |
| 11 | +git submodule update --init |
| 12 | +
|
| 13 | +open examples/demo-apps/apple_ios/LLaMA/LLaMA.xcodeproj |
| 14 | +``` |
| 15 | + |
| 16 | +Then click the Play button in Xcode to launch the app in Simulator. |
| 17 | + |
| 18 | +To run on a device, given that you already have it set up for development, you'll need to have a provisioning profile with the [`increased-memory-limit`](https://developer.apple.com/documentation/bundleresources/entitlements/com_apple_developer_kernel_increased-memory-limit) entitlement. Just change the app's bundle identifier to whatever matches your provisioning profile with the aforementioned capability enabled. |
| 19 | + |
| 20 | +After the app launched successfully, copy an exported ExecuTorch model (`.pte`) and tokenizer (`.bin`) files to the iLLaMA folder. |
| 21 | + |
| 22 | +For the Simulator, just drap&drop both files onto the Simulator window and save at `On My iPhone > iLLaMA` folder. |
| 23 | + |
| 24 | +For a device, open it in a separate Finder window, navigate to the Files tab, drag&drop both files to the iLLaMA folder and wait till the copying finishes. |
| 25 | + |
| 26 | +Now, follow the app's UI guidelines to pick the model and tokenizer files from the local filesystem and issue a prompt. |
| 27 | + |
| 28 | +Feel free to reuse the [`LLaMARunner`](https://github.com/pytorch/executorch/tree/main/examples/demo-apps/apple_ios/LLaMA/LLaMARunner/LLaMARunner/Exported) component from the demo app with its C++ [dependencies](https://github.com/pytorch/executorch/tree/main/examples/models/llama2) to your project and give it a spin. |
| 29 | + |
| 30 | +Click the image below to see it in action! |
14 | 31 |
|
15 | 32 | <a href="https://pytorch.org/executorch/main/_static/img/llama_ios_app.mp4">
|
16 | 33 | <img src="https://pytorch.org/executorch/main/_static/img/llama_ios_app.png" width="600" alt="iOS app running a LlaMA model">
|
17 | 34 | </a>
|
18 |
| - |
19 |
| -<-- |
20 |
| -<A HREF=https://github.com/pytorch/executorch/blob/main/docs/source/_static/img/llama_ios_app.png>torchchat on iOS</A> |
21 |
| ---> |
|
0 commit comments