llama-cpp-scripts / bin /llama-prompt.sh
iandennismiller's picture
new llama-prompt script
6a8d17c
raw
history blame
No virus
973 Bytes
#!/bin/bash
# if conf does not exist, create it
if [ ! -f "$HOME/.config/llama/llama-prompt.conf" ]; then
mkdir -p "$HOME/.config/llama"
cat <<EOF > "$HOME/.config/llama/llama-prompt.conf"
LLAMA_MODEL_NAME=$HOME/.ai/models/llama/teknium/OpenHermes-2.5-Mistral-7B/openhermes-2.5-mistral-7b-f16.gguf
LLAMA_CONTEXT_SIZE=8192
EOF
fi
source "$HOME/.config/llama/llama-prompt.conf"
# if an extra argument is provided, use it for LLAMA_MODEL_NAME
if [ -n "$2" ]; then
LLAMA_MODEL_NAME="$2"
fi
# if an extra argument is provided, use it for LLAMA_CONTEXT_SIZE
if [ -n "$3" ]; then
LLAMA_CONTEXT_SIZE="$3"
fi
# if no arguments are provided, print an error message and exit
if [ -z "$1" ]; then
echo "Usage: llama-prompt.sh <prompt> [model] [context_size]"
exit 1
fi
llama \
--file "$1" \
--model "$LLAMA_MODEL_NAME" \
--ctx-size "$LLAMA_CONTEXT_SIZE" \
--mirostat 2 \
--repeat-last-n 64 \
--log-disable 2> /dev/null | fmt -w 80