llama-cpp-scripts / bin /llama-koboldcpp.sh
iandennismiller's picture
koboldcpp launch script
2b59313
raw
history blame
1.12 kB
#!/bin/bash
# if conf does not exist, create it
if [ ! -f "$HOME/.config/llama/llama-koboldcpp.conf" ]; then
mkdir -p "$HOME/.config/llama"
cat <<EOF > "$HOME/.config/llama/llama-koboldcpp.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
KOBOLD_PORT=5000
KOBOLD_LOG=$HOME/.local/var/llama-koboldcpp.log
PYTHON_EXEC=$HOME/.virtualenvs/koboldcpp/bin/python
EOF
fi
source "$HOME/.config/llama/llama-koboldcpp.conf"
# if arg1 is "stop" then pkill the koboldcpp.py server
if [[ $# -eq 1 ]] && [[ $1 == "stop" ]]; then
echo "Stopping koboldcpp server..."
pkill -f "koboldcpp.py"
echo "ok"
exit
fi
# start server and pipe stdout+stderr to log file
cd ~/Work/koboldcpp || exit
"$PYTHON_EXEC" koboldcpp.py \
--gpulayers 1 \
--model "$LLAMA_MODEL_NAME" \
--contextsize "$LLAMA_CONTEXT_SIZE" \
--threads 6 \
--skiplauncher \
--smartcontext \
--noblas \
--host "0.0.0.0" \
--port "$KOBOLD_PORT" \
> "$KOBOLD_LOG" 2>&1 &
echo "Started koboldcpp server on port $KOBOLD_PORT"