File size: 1,241 Bytes
fd5eade
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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/sh
# MiniCPM5-2B (Q8_0, MXFP8 kernels) on AX8860 (llama.cpp + ggml-axera).
#   ./run.sh "<prompt>" [n]   greedy text completion, n tokens (default 512)
#   ./run.sh -c               multi-turn chat
#   ./run.sh -s [port]        OpenAI-compatible server
#
# Override CTX, CTXCP, GGUF or GGML_AXERA_KERNEL_DIR from the environment.
set -u
H=$(cd "$(dirname "$0")" && pwd)
chmod +x "$H"/bin/* 2>/dev/null
export LD_LIBRARY_PATH=/opt/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
export GGML_AXERA_KERNEL_DIR=${GGML_AXERA_KERNEL_DIR:-$H/kernels}
G=${GGUF:-$H/MiniCPM5-2B-Q8_0.gguf}
M="-m $G -ngl 99"
CTX=${CTX:-16384}
CTXCP=${CTXCP:-8}

case "${1:-}" in
-s)
    exec "$H/bin/llama-server" $M -c "$CTX" -b 4096 -ub 4096 -np 1 -ctxcp "$CTXCP" \
        --cache-ram 4096 --jinja --chat-template-file "$H/chat_template.jinja" \
        --reasoning "${REASONING:-auto}" --host 0.0.0.0 --port "${2:-8080}"
    ;;
-c)
    exec "$H/bin/llama-completion" $M -c "$CTX" -b 4096 -ub 4096 -cnv \
        --jinja --chat-template-file "$H/chat_template.jinja" --reasoning "${REASONING:-auto}"
    ;;
*)
    exec "$H/bin/llama-completion" $M -c "$CTX" -b 4096 -ub 4096 \
        -p "${1:-The capital of France is}" -n "${2:-512}" --temp 0 -no-cnv
    ;;
esac