Skip to content

Manuel030/llama2.c-android

 
 

Repository files navigation

llama2.c-android

Port of Andrej Karpathy's llama2.c to Android. You can run it as raw binary or use it as shared library.

You can use the prebuild binaries in libs or compile on your own:

# or wherever your ndk-build script resides
cd jni && $ANDROID_HOME/ndk-bundle/ndk-build

run as binary

Get e.g. termux and install APK to run binaries.

wget https://karpathy.ai/llama2c/model.bin -P out
adb push libs/<your abi>/llama2 /storage/emulated/0/Android/data
adb push model.bin /storage/emulated/0/Android/data
adb push tokenizer.bin /storage/emulated/0/Android/data

In Termux:

cp /storage/emulated/0/Android/llama2 .
chmod +x llama2
./llama2 model.bin

Llama2 in Termux

run as shared lib

wip

About

Inference Llama 2 in one file of pure C

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 68.6%
  • C 24.4%
  • Makefile 4.5%
  • Nix 2.5%