You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+24-7Lines changed: 24 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -54,7 +54,7 @@ source .venv/bin/activate
54
54
```
55
55
[skip default]: end
56
56
57
-
[shell default]: ./install_requirements.sh
57
+
[shell default]: ./install_requirements.sh
58
58
59
59
Installations can be tested by
60
60
@@ -269,17 +269,33 @@ The following assumes you've completed the steps for [Setting up ExecuTorch](#se
269
269
270
270
### Deploy and run on Android
271
271
272
-
#### Approach 1: Android Studio
272
+
#### Approach 1 (Recommended): Android Studio
273
273
274
274
If you have Android Studio set up, and you have Java 17 and Android SDK 34 configured, you can follow this step.
275
275
276
-
First, you need to download the following AAR file which contains the required Java library and its corresponding JNI library, for the app to build and run. You need to put the file to `android/Torchchat/app/libs/executorch.aar`
276
+
First, you need to download the ones of the following AAR files which contains the required Java library and its corresponding JNI library, for the app to build and run. You need to put the file to `android/Torchchat/app/libs/executorch.aar`
If your model uses BPE tokenizer (llama2 model for example), download `executorch-llama-torchchat-bpe.aar`.
279
279
280
+
If your model uses tiktoken tokenizer (llama3 model for example), download `executorch-llama-torchchat-tiktoken.aar`.
281
+
282
+
Currently the tokenizer is built at compile time, so you need to re-build the app when you need to use a different tokenizer for different model.
283
+
284
+
NOTE: The script to build the AAR can be found [here](https://github.com/pytorch/executorch/blob/main/build/build_android_library.sh). If you need to tweak with the tokenizer or runtime (for example use your own tokenizer or runtime library), you can modify the ExecuTorch code and use that script to build the AAR library.
You also need to push the model and tokenizer file to your device. Please refer to the docs above on generating the pte and bin file, or use E2E script (see section below) to generate and push the file.
@@ -300,10 +316,11 @@ Now, follow the app's UI guidelines to pick the model and tokenizer files from t
300
316
301
317
#### Approach 2: E2E Script
302
318
303
-
Alternatively, you can run `scripts/android_example.sh` which sets up Java, Android SDK Manager, Android SDK, Android emulator, builds the app, and launches it for you.
319
+
Alternatively, you can run `scripts/android_example.sh` which sets up Java, Android SDK Manager, Android SDK, Android emulator (if no physical device is found), builds the app, and launches it for you. It can be used if you don't have a GUI.
304
320
305
321
```
306
322
export TORCHCHAT_ROOT=$(pwd)
323
+
export USE_TIKTOKEN=ON # Set this only for tiktoken tokenizer
0 commit comments