Both the EasiiX Q8_0 and agentionai ROCmFP4-FAST MTP draft heads fail with 'missing tensor blk.0.hc_attn_norm.weight' against the STRIX_LEAN Uncensored model. The qwen4exp binary expects this hyper-connection attn norm tensor which neither draft GGUF carries. Using ngram-mod only until a compatible MTP head is found.
166 lines
5.9 KiB
Bash
Executable File
166 lines
5.9 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Serve kingjones777/Qwen3.8-Flash-Next-ROCmFP4-STRIX as
|
|
# frank-default-large via the charlie12345/ROCmFPX llama.cpp fork with
|
|
# PR #27742 (qwen4exp architecture) merged, on Dankclaw (Strix Halo
|
|
# gfx1151, unified memory).
|
|
#
|
|
# Runtime: ROCmFPX llama.cpp built at
|
|
# /home/dank/GitPackages/ROCmFPX/build-qwen38/bin/llama-server
|
|
# with -DGGML_HIP=ON -DGGML_HIP_ROCMI4_W4A4=ON
|
|
# -DCMAKE_HIP_ARCHITECTURES=gfx1151 -DLLAMA_BUILD_WEBUI=OFF.
|
|
#
|
|
# Model: 177B params (56B MoE + 51.2B PLE n-gram table). 512 experts,
|
|
# 10 used, 48 layers (12 attention + 36 SSM/Mamba,
|
|
# full_attention_interval=4), 2 KV heads x 256 dim, QSA
|
|
# indexer (4 heads, top_k=2048), hyper-connections (count=4, low_rank=320),
|
|
# PLE (layer 1). Q4_0_ROCMFP4_STRIX quant, 113.47 GiB, single file.
|
|
# PLE table (50.66 GiB Q8_0) streamed from page cache; never in GPU VRAM.
|
|
# GPU resident: ~63-69 GiB. Context: up to 131072.
|
|
# Loaded with mmap (default) into the Strix Halo unified memory pool.
|
|
# --fit off is set because the auto-fit code segfaults on this model's
|
|
# hyper-connection/indexer configuration; -ngl 999 places all layers on
|
|
# the GPU (SVM-backed).
|
|
#
|
|
# MTP draft head: both attempted heads (EasiiX Q8_0 and agentionai
|
|
# ROCmFP4-FAST) are INCOMPATIBLE with the STRIX_LEAN model — the
|
|
# qwen4exp binary expects blk.0.hc_attn_norm.weight which neither
|
|
# draft GGUF carries. Using ngram-mod only. Set SPEC_TYPE=none in
|
|
# the env to disable spec decoding.
|
|
#
|
|
# The Qwen-Sharp chat template (scripts/chat-template.jinja) is applied at
|
|
# runtime so the model emits reasoning in DeepSeek format; the reasoning
|
|
# trail is preserved across turns via CHAT_TEMPLATE_KWARGS.
|
|
set -euo pipefail
|
|
|
|
SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
|
|
ENV_FILE="${FRANK_LARGE_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) -------------------
|
|
: "${LLAMA_BIN:=/home/dank/GitPackages/ROCmFPX/build-qwen38/bin/llama-server}"
|
|
: "${MODEL_DIR:=/home/dank/models/kingjones-Qwen3.8-Flash-Next-ROCmFP4-STRIX}"
|
|
: "${MODEL_FILE:=Qwen3.8-Flash-Next-Q4_0-ROCmFP4-STRIX.gguf}"
|
|
: "${CHAT_TEMPLATE_FILE:=$SCRIPT_DIR/chat-template.jinja}"
|
|
: "${CHAT_TEMPLATE_KWARGS:={}}"
|
|
: "${ALIAS:=frank-default-large}"
|
|
: "${BIND_ADDR:=0.0.0.0}"
|
|
: "${LISTEN_PORT:=7770}"
|
|
: "${CTX_SIZE:=524288}"
|
|
: "${PARALLEL:=2}"
|
|
: "${BATCH_SIZE:=4096}"
|
|
: "${UBATCH_SIZE:=4096}"
|
|
: "${NUM_THREADS:=16}"
|
|
: "${THREAD_BATCH:=16}"
|
|
: "${CACHE_TYPE_K:=f16}"
|
|
: "${CACHE_TYPE_V:=f16}"
|
|
: "${CTX_CHECKPOINTS:=16}"
|
|
: "${CACHE_RAM:=8192}"
|
|
: "${FIT:=off}"
|
|
: "${TEMPERATURE:=0.7}"
|
|
: "${TOP_K:=20}"
|
|
: "${TOP_P:=0.8}"
|
|
: "${MIN_P:=0.0}"
|
|
: "${PRESENCE_PENALTY:=1.5}"
|
|
: "${REASONING:=on}"
|
|
: "${REASONING_FORMAT:=deepseek}"
|
|
: "${HSA_OVERRIDE_GFX_VERSION:=11.5.1}"
|
|
: "${SPEC_TYPE:=ngram-mod}"
|
|
: "${DRAFT_MODEL_DIR:=$MODEL_DIR}"
|
|
: "${DRAFT_MODEL_FILE:=Qwen3.8-Flash-Next-MTP-ROCmFP4-FAST.gguf}"
|
|
: "${SPEC_DRAFT_N_MAX:=3}"
|
|
: "${SPEC_DRAFT_N_MIN:=0}"
|
|
: "${SPEC_DRAFT_P_MIN:=0.75}"
|
|
: "${SPEC_DRAFT_NGL:=999}"
|
|
: "${SPEC_DRAFT_DEVICE:=ROCm0}"
|
|
: "${SPEC_DRAFT_TYPE_K:=f16}"
|
|
: "${SPEC_DRAFT_TYPE_V:=f16}"
|
|
|
|
MODEL="$MODEL_DIR/$MODEL_FILE"
|
|
for f in "$LLAMA_BIN" "$MODEL" "$CHAT_TEMPLATE_FILE"; do
|
|
if [[ ! -r "$f" ]]; then
|
|
echo "missing or unreadable required artifact: $f" >&2
|
|
exit 1
|
|
fi
|
|
done
|
|
if [[ ! -x "$LLAMA_BIN" ]]; then
|
|
echo "missing executable runtime: $LLAMA_BIN" >&2
|
|
exit 1
|
|
fi
|
|
|
|
# --- speculative decoding (MTP draft head) --------------------------------
|
|
# The MTP draft head is loaded as a separate GGUF sidecar via --model-draft.
|
|
# ngram-only specs (ngram-mod, etc.) do NOT need a draft model file.
|
|
# Set SPEC_TYPE=none in the env to disable speculative decoding entirely.
|
|
SPEC_ARGS=()
|
|
if [[ -n "$SPEC_TYPE" && "$SPEC_TYPE" != "none" ]]; then
|
|
SPEC_ARGS=(
|
|
--spec-type "$SPEC_TYPE"
|
|
--spec-draft-n-max "$SPEC_DRAFT_N_MAX"
|
|
--spec-draft-n-min "$SPEC_DRAFT_N_MIN"
|
|
--spec-draft-p-min "$SPEC_DRAFT_P_MIN"
|
|
)
|
|
if [[ "$SPEC_TYPE" == *draft-mtp* ]]; then
|
|
DRAFT_MODEL="$DRAFT_MODEL_DIR/$DRAFT_MODEL_FILE"
|
|
if [[ ! -r "$DRAFT_MODEL" ]]; then
|
|
echo "missing or unreadable draft model: $DRAFT_MODEL" >&2
|
|
exit 1
|
|
fi
|
|
SPEC_ARGS+=(
|
|
--model-draft "$DRAFT_MODEL"
|
|
--spec-draft-ngl "$SPEC_DRAFT_NGL"
|
|
--spec-draft-device "$SPEC_DRAFT_DEVICE"
|
|
--spec-draft-type-k "$SPEC_DRAFT_TYPE_K"
|
|
--spec-draft-type-v "$SPEC_DRAFT_TYPE_V"
|
|
)
|
|
fi
|
|
fi
|
|
|
|
SERVER_DIR="$(cd -- "$(dirname -- "$LLAMA_BIN")" && pwd)"
|
|
ROCM_PATH="${ROCM_PATH:-/opt/rocm}"
|
|
LIBRARY_PATH="$SERVER_DIR:$ROCM_PATH/lib:$ROCM_PATH/lib/rocm_sysdeps/lib:$ROCM_PATH/lib/llvm/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
|
|
|
|
exec /usr/bin/env \
|
|
ROCM_PATH="$ROCM_PATH" \
|
|
HIP_VISIBLE_DEVICES=0 \
|
|
LD_LIBRARY_PATH="$LIBRARY_PATH" \
|
|
HSA_OVERRIDE_GFX_VERSION="$HSA_OVERRIDE_GFX_VERSION" \
|
|
"$LLAMA_BIN" \
|
|
--model "$MODEL" \
|
|
--alias "$ALIAS" \
|
|
--chat-template-file "$CHAT_TEMPLATE_FILE" \
|
|
--chat-template-kwargs "$CHAT_TEMPLATE_KWARGS" \
|
|
--host "$BIND_ADDR" \
|
|
--port "$LISTEN_PORT" \
|
|
--jinja \
|
|
--device ROCm0 \
|
|
--gpu-layers 999 \
|
|
--parallel "$PARALLEL" \
|
|
--ctx-size "$CTX_SIZE" \
|
|
--batch-size "$BATCH_SIZE" \
|
|
--ubatch-size "$UBATCH_SIZE" \
|
|
--fit "$FIT" \
|
|
--flash-attn on \
|
|
--cache-type-k "$CACHE_TYPE_K" \
|
|
--cache-type-v "$CACHE_TYPE_V" \
|
|
--threads "$NUM_THREADS" \
|
|
--threads-batch "$THREAD_BATCH" \
|
|
--ctx-checkpoints "$CTX_CHECKPOINTS" \
|
|
--cache-ram "$CACHE_RAM" \
|
|
--cache-prompt \
|
|
--cache-idle-slots \
|
|
--metrics \
|
|
--temp "$TEMPERATURE" \
|
|
--top-p "$TOP_P" \
|
|
--top-k "$TOP_K" \
|
|
--min-p "$MIN_P" \
|
|
--presence-penalty "$PRESENCE_PENALTY" \
|
|
--reasoning "$REASONING" \
|
|
--reasoning-format "$REASONING_FORMAT" \
|
|
--reasoning-budget -1 \
|
|
--mmproj "$MMPROJ_PATH" \
|
|
"${SPEC_ARGS[@]}" |