llama-cpp-scripts / bin /llama-server.sh
iandennismiller's picture
openai-compatible server
5796f82
raw
history blame
No virus
779 Bytes
#!/bin/bash
# pip uninstall llama-cpp-python -y
# CMAKE_ARGS="-DLLAMA_METAL=on" FORCE_CMAKE=1 pip install -U llama-cpp-python --no-cache-dir
# pip install 'llama-cpp-python[server]'
# if conf does not exist, create it
if [ ! -f "$HOME/.config/llama/llama-server.conf" ]; then
mkdir -p "$HOME/.config/llama"
cat <<EOF > "$HOME/.config/llama/llama-server.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
LLAMA_PORT=8000
PYTHON_EXEC=$HOME/.virtualenvs/llama.cpp/bin/python
EOF
fi
source "$HOME/.config/llama/llama-server.conf"
$PYTHON_EXEC -m llama_cpp.server \
--model "$LLAMA_MODEL_NAME" \
--n_ctx "$LLAMA_CONTEXT_SIZE" \
--n_gpu_layers 1 \
--port "$LLAMA_PORT"