Open LDLINGLINGLING opened 2 months ago
Possibly the same issue as #8436 -- the error message is the same. Need to investigate further.
Did you tryied to compile directly on Termux using a proot? (Do not know if this servers your purpouse. If you want to use the model in a .apk, you can send commands directly to Termux from your apk. They have it well explained in the readme of Termux repo.)
I just compiled sucessfully in Android - Termux - Proot-Distro - Alpine
Something like this:
pkg install proot-distro
proot-distro install alpine
proot-distro login alpine --isolated
apk update
apk upgrade
apk install cmake clang git curl make
# Make sure curl works out of the box, i'm running a custom Alpine version and had to compile curl myself and replace the installed curl
curl https://example.com
git clone https://github.com/ggerganov/llama.cpp
mkdir build
cd bulld
cmake ..
make
cp bin/llama-cli /usr/bin/
mkdir models
cd models
# 4166 MegaBytes size model, make sure you have enought space
curl -vLO https://huggingface.co/TheBloke/dolphin-2.2.1-mistral-7B-GGUF/resolve/main/dolphin-2.2.1-mistral-7b.Q4_K_M.gguf
llama-cli -m dolphin-2.2.1-mistral-7b.Q4_K_M.gguf -p 'Hello dolphin'
You also have other distros like Debian or Arch Linux. Steps to install should be pretty much the same if you not a fan of musl.
Anyways, you need A LOT of RAM to run models. Expect it to don't work in most Android devices as the system will shutdown Termux (and all other running services if memory usage is that intense). Better to get a VPS server. There are very cheap ones.
thank you very much
thank you very much
Here you have very small models for low end smartphones: https://huggingface.co/QuantFactory/gpt2-GGUF
This is just a bit bigger, should work on most modern smartphones too. https://huggingface.co/tarikcelik/gpt2-xl-Q8_0-GGUF/tree/main
Chiming in here because I get a similar error when compiling on Termux.
I built llama.cpp using the termux instructions back on Apr 23, 2024. I still had a copy o fthat build and it still works with a previous version of Phi-3 that I'd downloaded. More recently I downloaded the imatrix version of the Phi-3 in-place update quantized by Bartowski at: https://huggingface.co/bartowski/Phi-3.1-mini-4k-instruct-GGUF (specifically using IQ4_XS model). I get an error of "Unknown model architecture: Phi3". (Possibly related to #8845?)
So, since Imatrix is a ibt new, I pulled the latest llama.cpp. I'd updated all my build-essentials and followed the instructions in the Android.md. Then, when running the llama-cli (I assume this replaced the "main") I get an error:
CANNOT LINK EXECUTBLE "bin/llama-cli": library "libomp.so" not found: ....
So after digging into this a bit, I rolled back to a commit from April/May timeframe and compiled with the same instructions: that one worked I tried from Early July (git checkout 213701b): didn't work I tried a commit from early June (2e666832e6): that one worked....
Somwhere between June and July there was a commit that breaks Termux Android instructions.
I'm using NDK r26, clang and the compile instructions found in the latest (as of today) Android.md file in the docs.
I'm on a Samsung Galaxy S21 Ultra if it makes a difference.
Attaching build example with two different commits and example, using Linux script replay command. Cut off generation so as not to wait, but I'm getting about 5 tok/s on that Phi-3.1 gguf model linked above.
As I'm reading through the logs, is this a different error since I'm not finding libomp? I have previously compiled with openCL, but on the Qualcomm Adreno GPU, it's poorly implemented (openCL) and I've seen that recently openCL for llama.cpp is deprecated, so I'm just trying to use the CPU (which is plenty fast with Phi3 for my use case).
What happened?
When I use android NDK to compile the bin file on Linux, and then transfer the bin file to Android termux and execute it, an error will be reported:CANNOT LINK EXECUTABLE "./llama-cli": library "libllama.so" not found: needed by main executable
Name and Version
./llama-cli -m /sdcard/Download/ggml-model-Q4_K_M.gguf --prompt "<用户>你知道openmbmb么"
What operating system are you seeing the problem on?
Other? (Please let us know in description)
Relevant log output