pantry/projects/github.com/ggerganov/llama.cpp/entrypoint.sh
James Reynolds 2b06942c62
GitHub.com/ggerganov/llama.cpp update (#3696)
* llama.cpp, github version instead of hardcoded version
* llama.cpp, check if model is specified, if yes, run it, if not, then download model
* Use entrypoint for custom llama.cpp invocation
* `llama.cpp` is just raw executable. This I think is our new pattern.
* To run chat use the entrypoint: `pkgx +brewkit -- run llama.cpp`

Co-authored-by: James Reynolds <magnsuviri@me.com>
Co-authored-by: Max Howell <mxcl@me.com>
2023-10-26 07:24:04 -04:00

33 lines
866 B
Bash
Executable file

#!/usr/bin/env -S pkgx +gum +aria2c bash
set -eo pipefail
test -n "$VERBOSE" && set -x
MODEL_URL="https://huggingface.co/TheBloke/dolphin-2.1-mistral-7B-GGUF/resolve/main/dolphin-2.1-mistral-7b.Q4_0.gguf"
MODEL_FILENAME=$(basename "$MODEL_URL")
MODEL_DIR="${XDG_DATA_HOME:-$HOME/.local/share}"/llama.cpp
if [ ! -f "$MODEL_DIR/$MODEL_FILENAME" ]; then
gum format <<EoMD
# downloading $MODEL_FILENAME
models will be placed: \`$PWD\`
> this may take a a few minutes…
EoMD
echo #spacer
mkdir -p "$MODEL_DIR"
aria2c "$MODEL_URL" --dir="$MODEL_DIR"
gum format "# All done!"
echo #spacer
fi
D="$(cd "$(dirname "$0")" && pwd)"
exec "$D"/bin/llama.cpp \
--model "$MODEL_DIR/$MODEL_FILENAME" \
-n 256 \
--repeat_penalty 1.0 \
--color \
--interactive \
--reverse-prompt "User:" \
--file "$D"/share/prompts/chat-with-bob.txt