|
1 | | -# Welcome to your Expo app 👋 |
| 1 | +# React Native Llama |
2 | 2 |
|
3 | | -This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app). |
| 3 | +<p align="center"> |
| 4 | + <img src="./assets/images/rnllama.png" width="200" alt="rnllama Logo"> |
| 5 | +</p> |
4 | 6 |
|
5 | | -## Get started |
| 7 | +A React Native mobile application for running LLaMA language models using ExecuTorch. This example is for iOS only for now. |
6 | 8 |
|
7 | | -1. Install dependencies |
| 9 | +## Features |
8 | 10 |
|
9 | | - ```bash |
10 | | - npm install |
11 | | - ``` |
| 11 | +- Run LLaMA models directly on device, build the UI using React Native |
| 12 | +- Tested using Llama 3.2 SpinQuant 1B on iPhone 12 Pro |
12 | 13 |
|
13 | | -2. Start the app |
14 | 14 |
|
15 | | - ```bash |
16 | | - npx expo start |
17 | | - ``` |
| 15 | +## Prerequisites |
18 | 16 |
|
19 | | -In the output, you'll find options to open the app in a |
| 17 | +- Node.js & npm |
| 18 | +- Xcode |
20 | 19 |
|
21 | | -- [development build](https://docs.expo.dev/develop/development-builds/introduction/) |
22 | | -- [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/) |
23 | | -- [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/) |
24 | | -- [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo |
| 20 | +## Installation |
25 | 21 |
|
26 | | -You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction). |
| 22 | +1. Clone the repository: `git clone [email protected]:pytorch/executorch.git` |
27 | 23 |
|
28 | | -## Get a fresh project |
| 24 | +2. Navigate to the root of the repository: `cd executorch` |
29 | 25 |
|
30 | | -When you're ready, run: |
| 26 | +3. Install dependencies: `./install_requirements.sh --pybind xnnpack && ./examples/models/llama/install_requirements.sh` |
31 | 27 |
|
32 | | -```bash |
33 | | -npm run reset-project |
34 | | -``` |
| 28 | +4. Follow the instructions in the [README](https://github.com/pytorch/executorch/blob/main/examples/models/llama/README.md#option-a-download-and-export-llama32-1b3b-model) to export a model as `.pte` |
35 | 29 |
|
36 | | -This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing. |
| 30 | +6. Navigate to the example: `cd examples/demo-apps/react-native/rnllama` |
37 | 31 |
|
38 | | -## Learn more |
| 32 | +7. Install dependencies: `npm install` |
39 | 33 |
|
40 | | -To learn more about developing your project with Expo, look at the following resources: |
| 34 | +8. Run the app: `npx expo run:ios --device` and select a USB connected iOS device |
41 | 35 |
|
42 | | -- [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides). |
43 | | -- [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web. |
| 36 | +9. Find the device in finder, and place the exported `.pte` model and the downloaded tokenizer under the app. |
44 | 37 |
|
45 | | -## Join the community |
| 38 | +10. Select the model and tokenizer in the app to start chatting: |
46 | 39 |
|
47 | | -Join our community of developers creating universal apps. |
| 40 | + |
48 | 41 |
|
49 | | -- [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute. |
50 | | -- [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions. |
0 commit comments