-
-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
run / install on TermUX Android #7
Comments
Thank you! If you like I can add this as instruction for android + TermUX and credit you. You can also make a pull request if you like. Can you try this: mkdir out If there are errors please let me know. I'll try your instructions when back at my home base. |
Your are welcome ~/llama2.c $ make run_gcc_static_incbin I'm looking for a solution now. can't be difficult |
Added make run_incbin target for termux on Android Usage: In termux do: pkg upgrade pkg install git pkg install make pkg install clang pkg install wget git clone https://github.com/trholding/llama2.c cd llama2.c make run_incbin ./run Ref: #7
There is a new On a fresh termux install this should work. pkg upgrade
pkg install git
pkg install make
pkg install clang
pkg install wget
git clone https://github.com/trholding/llama2.c
cd llama2.c
make run_incbin
./run The make target will automatically download create the out dir, download and rename the model and build. I haven't tested yet. |
Tested on fresh termux install and it works ~/llama2.c $ ./run L2E $ dog and sheep |
I compiled with gcc inside termux glibc enviroment gcc -D OPENMP -Ofast -fopenmp -foffload-options="-Ofast -lm" -march=native run.c -lm -o run cpu - sdm662 OMP_NUM_THREADS=1 ./run out/model.bin -n 256 -i "Once upon a time" 90 tok/s OMP_NUM_THREADS=2 ./run out/model.bin -n 256 -i "Once upon a time" 120 tok/s 4 threads - 111 tok/s |
It's great that there is OpenMP support. Most probably there could be OpenACC support too.
Phones have a decent performance I'll add a series of make targets for termux in the Makefile and get back here. Do you guys think I should add these in the targets or do most users have these installed?: For clang
For gcc
|
@trholding termux's clang supports openmp, libomp.a provided by clang clang -D OPENMP -Ofast -fopenmp -march=native run.c -lm -o run OMP_NUM_THREADS=2 ./run out/model.bin -n 256 -i "Once upon a time" 115 tok/s vs 90 without openmp |
This fork is only focused on the C inference part. That is you could build run.c and run it. I don't have much clues about getting python up in termux. It looks like your current termux environment is not sufficient to run the python training and inference as a result of requirements not getting installed. As seen in your screenshot, ninja fails to build / install... You could ask here for help: termux/termux-packages#8951 If you are running the python parts, please use upstream https://github.com/karpathy/llama2.c . This is a friendly fork that is 2 weeks out of sync. Hope your issues will get resolved. |
not an issue
Install TermUX form Fdroid
pkg upgrade
pkg install git
pkg install make
pkg install clang
pkg install wget
git clone https://github.com/trholding/llama2.c
cd llama2.c
make runfast
wget https://huggingface.co/karpathy/tinyllamas/resolve/main/stories15M.bin
~/llama2.c $ ./run stories15M.bin
Once upon a time, there was a little boy named Timmy. Timmy was very hungry and wanted to eat a big turkey. But the turkey was on his way to a party.
Timmy tried to catch the turkey, but it was too fast. The turkey ran away and Timmy felt sad.
But then, Timmy saw a big cake. He wanted to eat it, so he cut a slice. But the cake was too big and Timmy's sister had already eaten it.
Timmy didn't like that. He wanted the cake, but his sister was being stubborn. Timmy's mom came over and saw what was happening. She told Timmy's sister to be kind and share the cake. So, Timmy's mom cut a big slice of the cake and they all enjoyed it together.
achieved tok/s: 281.859070
The text was updated successfully, but these errors were encountered: