#!/bin/sh # MiniCPM5-2B (Q8_0, MXFP8 kernels) on AX8860 (llama.cpp + ggml-axera). # ./run.sh "" [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