File size: 914 Bytes
5796f82
 
 
 
 
 
 
 
 
0c687a2
5796f82
 
 
 
 
a7e8a57
 
22e19ef
d443dcd
a7e8a57
 
 
 
0c687a2
22e19ef
5796f82
22e19ef
 
0c687a2
 
d443dcd
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/bash

# 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
LLAMA_LOG=$HOME/.local/var/llama-server.log
EOF
fi

source "$HOME/.config/llama/llama-server.conf"

# if arg1 is "stop" then pkill the koboldcpp.py server
if [[ $# -eq 1 ]] && [[ $1 == "stop" ]]; then
    echo "Stopping llama server"
    pkill -f "llama-server --model"
    echo "ok"
    exit
fi

# start server and pipe stdout+stderr to log file
llama-server \
    --model "$LLAMA_MODEL_NAME" \
    --ctx-size "$LLAMA_CONTEXT_SIZE" \
    --n-gpu-layers 1 \
    --port "$LLAMA_PORT" \
    > "$LLAMA_LOG" 2>&1 &

echo "Started llama.cpp server. Logging to $LLAMA_LOG"