#!/usr/bin/env bash # Serve unsloth/Qwen3.8-27B-UD-Q8_K_XL as frank-default-large with a # z-lab DFlash2 drafter (Qwen3.8-27B-DFlash2-Q4_K_M) on the Vulkan backend. # # Runtime: upstream llama.cpp PR #27342 (DFlash2 support) built with # GGML_VULKAN=ON for the Strix Halo gfx1151 (RADV). DFlash2 selects its # candidates through TOP_K + ARGMAX ops that the HIP backend does not # implement, so the whole stack runs on Vulkan0. # # The target and the drafter share the Qwen3.8 arch. DFlash is lossless # under strict rejection sampling. --spec-draft-n-max clamps to the drafter's # trained block size (8). # # Tunables come from frank-default-large.env in this directory unless # FRANK_LARGE_ENV_FILE overrides that path. 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/llama.cpp-dflash2/build-dflash2/bin/llama-server}" : "${MODEL_DIR:=/home/dank/models}" : "${MODEL_FILE:=Qwen3.8-27B-UD-Q8_K_XL.gguf}" : "${DRAFT_FILE:=Qwen3.8-27B-DFlash2-Q4_K_M.gguf}" : "${ALIAS:=frank-default-large}" : "${BIND_ADDR:=0.0.0.0}" : "${LISTEN_PORT:=52625}" : "${CTX_SIZE:=262144}" : "${PARALLEL:=1}" : "${BATCH_SIZE:=4096}" : "${UBATCH_SIZE:=4096}" : "${CACHE_TYPE_K:=f16}" : "${CACHE_TYPE_V:=f16}" : "${CTX_CHECKPOINTS:=16}" : "${CACHE_RAM:=8192}" : "${SPEC_TYPE:=draft-dflash}" : "${SPEC_DRAFT_N_MAX:=8}" : "${SPEC_DRAFT_N_MIN:=0}" : "${SPEC_DRAFT_P_MIN:=0.0}" : "${SPEC_DRAFT_P_SPLIT:=0.10}" : "${TEMPERATURE:=0.7}" : "${TOP_P:=0.95}" : "${REASONING:=on}" : "${REASONING_FORMAT:=deepseek}" : "${VERBOSITY:=4}" MODEL="$MODEL_DIR/$MODEL_FILE" DRAFT="$MODEL_DIR/$DRAFT_FILE" if [[ ! -f "$MODEL" ]]; then echo "missing required file: $MODEL" >&2 exit 1 fi if [[ ! -f "$DRAFT" ]]; then echo "missing DFlash2 drafter: $DRAFT" >&2 exit 1 fi if [[ ! -x "$LLAMA_BIN" ]]; then echo "missing llama-server binary: $LLAMA_BIN" >&2 exit 1 fi exec "$LLAMA_BIN" \ --model "$MODEL" \ --alias "$ALIAS" \ --host "$BIND_ADDR" \ --port "$LISTEN_PORT" \ -dev Vulkan0 \ -ngl 999 \ -c "$CTX_SIZE" \ -b "$BATCH_SIZE" \ -ub "$UBATCH_SIZE" \ -fa on \ -ctk "$CACHE_TYPE_K" \ -ctv "$CACHE_TYPE_V" \ -np "$PARALLEL" \ -ctxcp "$CTX_CHECKPOINTS" \ --cache-ram "$CACHE_RAM" \ --cache-prompt \ --metrics \ --no-mmap \ --spec-type "$SPEC_TYPE" \ --spec-draft-model "$DRAFT" \ --spec-draft-device Vulkan0 \ --spec-draft-ngl 999 \ --spec-draft-type-k f16 \ --spec-draft-type-v f16 \ --spec-draft-n-max "$SPEC_DRAFT_N_MAX" \ --spec-draft-n-min "$SPEC_DRAFT_N_MIN" \ --spec-draft-p-min "$SPEC_DRAFT_P_MIN" \ --spec-draft-p-split "$SPEC_DRAFT_P_SPLIT" \ --temp "$TEMPERATURE" \ --top-p "$TOP_P" \ --reasoning "$REASONING" \ --reasoning-format "$REASONING_FORMAT" \ --reasoning-budget -1 \ -lv "$VERBOSITY"