Configure DeepSeek reasoning and large-model ubatch sweep

This commit is contained in:
Frank
2026-08-25 16:52:45 -07:00
parent 8c8c3f7cd0
commit d6ea71b9a4
7 changed files with 99 additions and 20 deletions
+16 -14
View File
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
# bench-ubatch-rocmi4.sh — sweep ubatch size at 8k context on the
# frank-default-large ROCmI4 embedded-MTP stack (dankclaw, gfx1151).
# frank-default-large ROCmFPX standalone-MTP stack (dankclaw, gfx1151).
#
# Boots one llama-server instance per ubatch on a scratch port with a fixed
# -b and -c 8192, runs a standardized ~75%-of-ctx prose workload, and reads
@@ -26,21 +26,23 @@ if [[ -f "$ENV_FILE" ]]; then
fi
# --- sweep parameters -------------------------------------------------------
: "${UBATCH_MIN:=512}"
: "${UBATCH_MAX:=4096}"
: "${UBATCH_STEP:=512}"
: "${UBATCH_MIN:=256}"
: "${UBATCH_MAX:=6144}"
: "${UBATCH_STEP:=256}"
: "${UBATCH_VALUES:=256 512 768 1024 1280 1536 2048 3072 4096 5120 6144}"
: "${CTX:=8192}" # 8k contexts
: "${BENCH_BATCH:=$CTX}" # fixed batch = ctx, so the full 8k prompt fits
: "${OUT_TOKENS:=256}"
: "${RUNS:=3}" # decode runs per ubatch
: "${PORT_BASE:=7894}" # scratch ports 7894..
: "${STOPSVC:=0}" # stop/restart the live unit for a clean GPU
: "${STOPSVC:=1}" # stop/restart the live unit for a clean GPU
# --- resolved paths (fall back to serve-script defaults) --------------------
: "${LLAMA_BIN:=/home/dank/rocmi4-qwen38/ROCmFPX/build-rocmi4-w4a4/bin/llama-server}"
: "${MODEL_DIR:=/home/dank/models/eemin-Qwen3.8-27B-ROCMI4-MTP}"
: "${MODEL_FILE:=Qwen3.8-27B-Q4_0_ROCMI4.gguf}"
: "${MMPROJ_FILE:=mmproj-BF16.gguf}"
: "${LLAMA_BIN:=/home/dank/ciru-qwen38/ROCmFPX/build-promptforge/bin/llama-server}"
: "${MODEL_DIR:=/home/dank/models/kingjones-Qwen3.8-27B-STRIX-MTP}"
: "${MODEL_FILE:=Qwen3.8-27B-Uncensored-Q6_0_ROCMFPX_AGENT.gguf}"
: "${MTP_DRAFT_FILE:=$MODEL_DIR/mtp-Qwen3.8-27B-Q4_0.gguf}"
: "${MMPROJ_FILE:=mmproj-Qwen3.8-27B-Q8_0.gguf}"
: "${CHAT_TEMPLATE_FILE:=$SCRIPT_DIR/chat-template.jinja}"
: "${ALIAS:=frank-default-large}"
: "${HSA_OVERRIDE_GFX_VERSION:=11.5.1}"
@@ -114,7 +116,7 @@ run_one() {
--model "$MODEL" \
"${MMPROJ_ARGS[@]}" \
--chat-template-file "$CHAT_TEMPLATE_FILE" \
--chat-template-kwargs '{"enable_thinking":true,"preserve_thinking":true}' \
--chat-template-kwargs '{"enable_thinking":true,"preserve_thinking":true,"preserve_reasoning":true}' \
--alias bench-ubatch \
--host 127.0.0.1 --port "$port" \
-dev ROCm0 -ngl 999 -np 1 \
@@ -122,14 +124,14 @@ run_one() {
-c "$CTX" -b "$BENCH_BATCH" -ub "$ubatch" \
-fa on -ctk f16 -ctv f16 -ctxcp 16 \
--cache-ram 8192 --cache-prompt --metrics --no-mmap \
--spec-type draft-mtp --spec-mtp-strict-qwen \
--spec-draft-device ROCm0 --spec-draft-ngl all \
--spec-type draft-mtp --model-draft "$MTP_DRAFT_FILE" \
--spec-draft-device ROCm0 --spec-draft-ngl 999 \
--spec-draft-type-k f16 --spec-draft-type-v f16 \
--spec-draft-n-max "$MTP_N_MAX" --spec-draft-n-min 0 \
--spec-draft-p-min "$MTP_P_MIN" \
--spec-draft-backend-sampling \
--temp 0.7 --top-p 0.95 \
--reasoning on --reasoning-format deepseek --reasoning-budget -1 \
--reasoning "$REASONING" --reasoning-format "$REASONING_FORMAT" --reasoning-budget -1 \
-lv 4 >>"$log" 2>&1 &
local pid=$!
wait_health "$pid" "$port" || { tail -30 "$log"; return 2; }
@@ -207,7 +209,7 @@ main() {
stop_live_service
local idx=0 ubatch port
printf "%-10s %-14s %-10s\n" "UBATCH" "PREFILL" "GEN_TPS"
for ubatch in $(seq "$UBATCH_MIN" "$UBATCH_STEP" "$UBATCH_MAX"); do
for ubatch in $UBATCH_VALUES; do
port=$((PORT_BASE + idx))
run_one "$ubatch" "$port" "$OUT_TOKENS" "$RUNS"
idx=$((idx + 1))
+6 -5
View File
@@ -22,8 +22,9 @@ MTP_DRAFT_FILE=$MODEL_DIR/mtp-Qwen3.8-27B-Q4_0.gguf
MMPROJ_FILE=mmproj-Qwen3.8-27B-Q8_0.gguf
# Qwen-Sharp chat template (tracked in the repo, staged on the host). The Sharp
# template drives thinking on by default (medium effort) and produces the
# peg-native + deepseek chat/reasoning shape the Pi agent expects.
# template drives thinking on by default (medium effort); the server emits
# reasoning in DeepSeek format so clients receive reasoning_content separately
# instead of literal <think> tags in content.
CHAT_TEMPLATE_FILE=/home/dank/serverAppConfigs/scripts/chat-template.jinja
CHAT_TEMPLATE_KWARGS='{"enable_thinking":true,"preserve_thinking":true,"preserve_reasoning":true}'
@@ -63,10 +64,10 @@ MIN_P=0.0
PRESENCE_PENALTY=1.5
# Reasoning on (Sharp template drives it; preserve_thinking + preserve_reasoning
# keep the reasoning trail in the conversation). reasoning-format none lets the
# template project the reasoning content into reasoning_content.
# keep the reasoning trail in the conversation). DeepSeek format projects the
# reasoning into the API's reasoning_content field instead of content tags.
REASONING=on
REASONING_FORMAT=none
REASONING_FORMAT=deepseek
# Strix Halo unified memory + native gfx1151 detection for this ROCmFPX build.
HSA_OVERRIDE_GFX_VERSION=11.5.1