Skip to content

Commit c780e75

Browse files
authored
Further tidy on Android instructions README.md (#7077)
* Further tidy on Android instructions README.md Fixed some logic when following readme direction * Clean up redundent information A new user arriving will see simple directions on llama.cpp homepage * corrected puncuation Period after cmake, colon after termux * re-word for clarity method seems to be more correct, instead of alternative in this context * Organized required packages per build type building llama.cpp with NDK on a pc doesn't require installing clang, cmake, git, or wget in termux. * README.md corrected title * fix trailing whitespace
1 parent 48b2f9c commit c780e75

File tree

1 file changed

+18
-23
lines changed

1 file changed

+18
-23
lines changed

README.md

Lines changed: 18 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -936,25 +936,35 @@ If your issue is with model generation quality, then please at least scan the fo
936936
937937
### Android
938938
939-
#### Building the Project using Android NDK
940-
You can easily run `llama.cpp` on Android device with [termux](https://termux.dev/).
939+
#### Build on Android using Termux
940+
[Termux](https://github.com/termux/termux-app#installation) is a method to execute `llama.cpp` on an Android device (no root required).
941+
```
942+
apt update && apt upgrade -y
943+
apt install git make cmake
944+
```
941945
942-
First, install the essential packages for termux:
946+
It's recommended to move your model inside the `~/` directory for best performance:
943947
```
944-
pkg install clang wget git cmake
948+
cd storage/downloads
949+
mv model.gguf ~/
945950
```
946-
Second, obtain the [Android NDK](https://developer.android.com/ndk) and then build with CMake:
947951
948-
You can execute the following commands on your computer to avoid downloading the NDK to your mobile. Of course, you can also do this in Termux.
952+
[Get the code](https://github.com/ggerganov/llama.cpp#get-the-code) & [follow the Linux build instructions](https://github.com/ggerganov/llama.cpp#build) to build `llama.cpp`.
953+
954+
#### Building the Project using Android NDK
955+
Obtain the [Android NDK](https://developer.android.com/ndk) and then build with CMake.
949956
957+
Execute the following commands on your computer to avoid downloading the NDK to your mobile. Alternatively, you can also do this in Termux:
950958
```
951959
$ mkdir build-android
952960
$ cd build-android
953961
$ export NDK=<your_ndk_directory>
954962
$ cmake -DCMAKE_TOOLCHAIN_FILE=$NDK/build/cmake/android.toolchain.cmake -DANDROID_ABI=arm64-v8a -DANDROID_PLATFORM=android-23 -DCMAKE_C_FLAGS=-march=armv8.4a+dotprod ..
955963
$ make
956964
```
957-
Install [termux](https://termux.dev/) on your device and run `termux-setup-storage` to get access to your SD card.
965+
966+
Install [termux](https://github.com/termux/termux-app#installation) on your device and run `termux-setup-storage` to get access to your SD card (if Android 11+ then run the command twice).
967+
958968
Finally, copy these built `llama` binaries and the model file to your device storage. Because the file permissions in the Android sdcard cannot be changed, you can copy the executable files to the `/data/data/com.termux/files/home/bin` path, and then execute the following commands in Termux to add executable permission:
959969
960970
(Assumed that you have pushed the built executable files to the /sdcard/llama.cpp/bin path using `adb push`)
@@ -976,25 +986,10 @@ $cd /data/data/com.termux/files/home/bin
976986
$./main -m ../model/llama-2-7b-chat.Q4_K_M.gguf -n 128 -cml
977987
```
978988
979-
Here is a demo of an interactive session running on Pixel 5 phone:
989+
Here's a demo of an interactive session running on Pixel 5 phone:
980990
981991
https://user-images.githubusercontent.com/271616/225014776-1d567049-ad71-4ef2-b050-55b0b3b9274c.mp4
982992
983-
#### Build on Android using Termux
984-
[Termux](https://github.com/termux/termux-app#installation) is an alternative to execute `llama.cpp` on an Android device (no root required).
985-
```
986-
apt update && apt upgrade -y
987-
apt install git
988-
```
989-
990-
It's recommended to move your model inside the `~/` directory for best performance:
991-
```
992-
cd storage/downloads
993-
mv model.gguf ~/
994-
```
995-
996-
[Follow the Linux build instructions](https://github.com/ggerganov/llama.cpp#build) to build `llama.cpp`.
997-
998993
### Docker
999994
1000995
#### Prerequisites

0 commit comments

Comments
 (0)