| # if conf does not exist, create it | |
| if [ ! -f "$HOME/.config/llama/llama-update.conf" ]; then | |
| mkdir -p "$HOME/.config/llama" | |
| cat <<EOF > "$HOME/.config/llama/llama-update.conf" | |
| LLAMA_CPP_GIT=$HOME/Work/llama.cpp | |
| BIN_PATH=$HOME/.local/bin | |
| EOF | |
| fi | |
| source $HOME/.config/llama/llama-update.conf | |
| # if llama.cpp directory does not exist, clone it | |
| if [ ! -d "$LLAMA_CPP_GIT" ]; then | |
| git clone https://github.com/ggerganov/llama.cpp "$LLAMA_CPP_GIT" | |
| else | |
| cd "$LLAMA_CPP_GIT" || exit | |
| git pull | |
| fi | |
| cd "$LLAMA_CPP_GIT" || exit | |
| rm -rf build | |
| mkdir build | |
| cd build || exit | |
| cmake .. | |
| cmake --build . --config Release | |
| mkdir -p "$BIN_PATH" | |
| install -c -v -m 755 bin/main "$BIN_PATH/llama" | |
| install -c -v bin/ggml-metal.metal "$BIN_PATH" | |
| install -c -v -m 755 bin/llava-cli "$BIN_PATH"/llava | |
| install -c -v -m 755 bin/finetune "$BIN_PATH/llama-finetune" | |
| install -c -v -m 755 bin/speculative "$BIN_PATH/llama-speculative" | |