141 lines
4.3 KiB
Bash
Executable File
141 lines
4.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Serve the Qwen3.8-27B pipeline-parallel head on Dankclaw.
|
|
#
|
|
# Runs llama-server (b10433) with --rpc pointing at the worker on
|
|
# Dankserver. The model is split pipeline-style across [RPC0, iGPU]:
|
|
# layers run in order, hidden states cross the ethernet boundary once per
|
|
# token step.
|
|
#
|
|
# IMPORTANT: no --device flag. The RPC device only joins the model's device
|
|
# list through default device selection; an explicit --device silently drops
|
|
# it. See the header of frank-default-large.env.
|
|
#
|
|
# Tunables come from frank-default-large.env in this directory unless the
|
|
# FRANK_PP_HEAD_ENV_FILE environment variable overrides that path.
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
ENV_FILE="${FRANK_PP_HEAD_ENV_FILE:-$SCRIPT_DIR/frank-default-large.env}"
|
|
if [[ -f "$ENV_FILE" ]]; then
|
|
set -a
|
|
# shellcheck disable=SC1090
|
|
source "$ENV_FILE"
|
|
set +a
|
|
fi
|
|
|
|
# --- defaults (used when the env file does not set them) -------------------
|
|
: "${MODEL_DIR:=/home/dank/models}"
|
|
: "${MODEL_FILE:=Qwen3.8-27B-Uncensored-Q6_K.gguf}"
|
|
: "${HEAD_BIN:=/home/dank/llama.cpp/build/bin/llama-server}"
|
|
: "${ALIAS:=frank-pp-large}"
|
|
: "${BIND_ADDR:=0.0.0.0}"
|
|
: "${LISTEN_PORT:=7770}"
|
|
: "${RPC_SERVERS:=192.168.0.235:50052}"
|
|
: "${TENSOR_SPLIT:=1,1}"
|
|
: "${CTX_SIZE:=131072}"
|
|
: "${PARALLEL:=1}"
|
|
: "${SPEC_NONE:=0}"
|
|
: "${SPEC_DEFAULT:=1}"
|
|
: "${MTP:=0}"
|
|
: "${SPEC_DRAFT_N_MAX:=4}"
|
|
: "${SPEC_DRAFT_MODEL:=}"
|
|
: "${SPEC_NGRAM_MOD_N_MIN:=48}"
|
|
: "${SPEC_NGRAM_MOD_N_MAX:=64}"
|
|
: "${SPEC_NGRAM_MOD_N_MATCH:=24}"
|
|
: "${CACHE_TYPE_K:=q8_0}"
|
|
: "${CACHE_TYPE_V:=f16}"
|
|
: "${BATCH_SIZE:=8192}"
|
|
: "${UBATCH_SIZE:=256}"
|
|
: "${TEMPERATURE:=1.0}"
|
|
: "${TOP_K:=20}"
|
|
: "${TOP_P:=0.95}"
|
|
: "${MIN_P:=0.0}"
|
|
: "${THREADS:=12}"
|
|
: "${THREADS_HTTP:=1}"
|
|
: "${VERBOSITY:=4}"
|
|
: "${DIRECT_IO:=1}"
|
|
|
|
MODEL="$MODEL_DIR/$MODEL_FILE"
|
|
|
|
if [[ ! -f "$MODEL" ]]; then
|
|
echo "missing required file: $MODEL" >&2
|
|
exit 1
|
|
fi
|
|
if [[ ! -x "$HEAD_BIN" ]]; then
|
|
echo "missing head binary: $HEAD_BIN" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# --- RPC endpoints -----------------------------------------------------------
|
|
RPC_ARGS=()
|
|
for s in ${RPC_SERVERS//,/ }; do
|
|
RPC_ARGS+=(--rpc "$s")
|
|
done
|
|
|
|
# --- split fractions ---------------------------------------------------------
|
|
SPLIT_ARGS=()
|
|
if [[ -n "${TENSOR_SPLIT}" ]]; then
|
|
SPLIT_ARGS+=(--tensor-split "${TENSOR_SPLIT}")
|
|
fi
|
|
|
|
# --- speculative decoding -----------------------------------------------------
|
|
SPEC_ARGS=()
|
|
if [[ "${SPEC_NONE}" == "1" ]]; then
|
|
SPEC_ARGS+=(--spec-type none)
|
|
else
|
|
if [[ "${SPEC_DEFAULT}" == "1" ]]; then
|
|
if [[ "${MTP}" == "1" ]]; then
|
|
# MTP first (bundled in-model head by default, or a standalone
|
|
# draft file when SPEC_DRAFT_MODEL is set), then the ngram-mod
|
|
# fallback. Order matters: --spec-type appends to the impl chain.
|
|
SPEC_ARGS+=(--spec-type draft-mtp)
|
|
SPEC_ARGS+=(--spec-draft-n-max "${SPEC_DRAFT_N_MAX}")
|
|
if [[ -n "${SPEC_DRAFT_MODEL}" ]]; then
|
|
if [[ ! -f "${SPEC_DRAFT_MODEL}" ]]; then
|
|
echo "SPEC_DRAFT_MODEL file missing: ${SPEC_DRAFT_MODEL}" >&2
|
|
exit 1
|
|
fi
|
|
SPEC_ARGS+=(--spec-draft-model "${SPEC_DRAFT_MODEL}")
|
|
fi
|
|
fi
|
|
SPEC_ARGS+=(--spec-default)
|
|
SPEC_ARGS+=(--spec-ngram-mod-n-min "${SPEC_NGRAM_MOD_N_MIN}")
|
|
SPEC_ARGS+=(--spec-ngram-mod-n-max "${SPEC_NGRAM_MOD_N_MAX}")
|
|
SPEC_ARGS+=(--spec-ngram-mod-n-match "${SPEC_NGRAM_MOD_N_MATCH}")
|
|
else
|
|
echo "SPEC_NONE=0 requires SPEC_DEFAULT=1" >&2
|
|
exit 1
|
|
fi
|
|
fi
|
|
|
|
# --- load mode ----------------------------------------------------------------
|
|
LOAD_ARGS=()
|
|
if [[ "${DIRECT_IO}" == "1" ]]; then
|
|
LOAD_ARGS+=(--direct-io)
|
|
fi
|
|
|
|
exec "$HEAD_BIN" \
|
|
--model "$MODEL" \
|
|
"${RPC_ARGS[@]}" \
|
|
"${SPLIT_ARGS[@]}" \
|
|
"${SPEC_ARGS[@]}" \
|
|
"${LOAD_ARGS[@]}" \
|
|
--gpu-layers all \
|
|
--fit off \
|
|
--cache-type-k "$CACHE_TYPE_K" \
|
|
--cache-type-v "$CACHE_TYPE_V" \
|
|
--ctx-size "$CTX_SIZE" \
|
|
--parallel "$PARALLEL" \
|
|
--batch-size "$BATCH_SIZE" \
|
|
--ubatch-size "$UBATCH_SIZE" \
|
|
--temp "$TEMPERATURE" \
|
|
--top-k "$TOP_K" \
|
|
--top-p "$TOP_P" \
|
|
--min-p "$MIN_P" \
|
|
--threads "$THREADS" \
|
|
--threads-http "$THREADS_HTTP" \
|
|
--alias "$ALIAS" \
|
|
-lv "$VERBOSITY" \
|
|
--host "$BIND_ADDR" \
|
|
--port "$LISTEN_PORT"
|