motif64

m64_1eb210871274 / start.sh

47 lines, 3.0 KBraw
1#!/usr/bin/env bash2# pi17-qwen4-35b-a3b-q4xl-mtp-strixhalo entrypoint. Runs inside the container; takes no arguments.3#   127.0.0.1:9000     llama-server (llama.cpp dd6b0fa, Vulkan): Qwen4-35B-A3B UD-Q4_K_XL + MTP drafts, q8_0 KV, CONTEXT ctx (default 262144)4#   127.0.0.1:4096     cli_shim.py: `pi -p --mode json` once per prompt5#   0.0.0.0:$M64_PORT  agent_gateway.py: the agent.session API6set -eu7export HOME=/scratch/home WORK_DIR=/scratch/work SHIM_HOMES=/scratch/homes8mkdir -p "$HOME" "$WORK_DIR/sessions" "$SHIM_HOMES" /scratch/cache9export XDG_CACHE_HOME=/scratch/cache10# The model is native to 1M tokens; 262144 by default, the window the airbench checkup harness runs every model at.11CTX=${CONTEXT:-262144}1213echo '{"phase":"loading","detail":"llama.cpp: loading Qwen4-35B-A3B UD-Q4_K_XL (30 GB to GPU memory, the 22 GB n-gram table mapped in system RAM)"}' >> "$M64_STATUS"14# The same engine line as opencode-qwen4-35b-a3b-q4xl-mtp-strixhalo (m64_76ec9c804807, 49/49 in 48 min and 48/49 in15# 45 min), so this pair differs only in the harness. Measured on this Radeon 8060S: MTP speculative decoding with the16# model's own head, 2 tokens per draft, takes UD-Q4_K_XL generation from 47 to 57-60 t/s in thinking mode (1 draft17# was as fast, 3 slower). -ub 2048, q8_0 KV, weights read once (-lm none), and the model card's thinking-mode18# sampling, exactly (temperature 1.0, top-p 0.95, top-k 20, min-p 0, presence penalty 0).19/opt/llama/bin/llama-server \20    -m /weights/qwen4/UD-Q4_K_XL/Qwen4-35B-A3B-UD-Q4_K_XL-00001-of-00002.gguf \21    --mmproj /weights/qwen4/mmproj-F16.gguf --image-min-tokens 1024 \22    -c "$CTX" -np 1 -ngl 999 -fa on -ctk q8_0 -ctv q8_0 -b 2048 -ub 2048 -lm none --jinja \23    --spec-type draft-mtp --spec-draft-n-max 2 \24    --temp 1.0 --top-k 20 --top-p 0.95 --min-p 0 --presence-penalty 0 \25    --no-ui --metrics --alias qwen4-35b-a3b-ud-q4_k_xl --host 127.0.0.1 --port 9000 &26LLM_PID=$!2728export AGENT_HARNESS=pi29export AGENT_HARNESS_TITLE="pi coding agent 1.7.0 (earendil-works/pi)"30export AGENT_MODEL=qwen4-35b-a3b-ud-q4_k_xl UPSTREAM_MODEL=qwen4-35b-a3b-ud-q4_k_xl31export AGENT_CONTEXT=$CTX AGENT_VISION=132# The airbench checkup harness's settings (checkup.py output_cap / compaction_reserve): 32768 out at both33# windows, and pi compacts with a 65536-token reserve at 262144 (49152 at 131072).34export AGENT_MAX_OUT=3276835if [ "$CTX" -ge 262144 ]; then export AGENT_COMPACTION_RESERVE=65536; else export AGENT_COMPACTION_RESERVE=49152; fi36export LLM_BASE_URL=http://127.0.0.1:9000/v137export RELAY_URL=http://127.0.0.1:9000        # the gateway's health check: llama-server's /health38export NODE_USE_ENV_PROXY=1                   # web access, if granted, goes through the m64 gate39/opt/gateway/bin/python3 -u /capsule/cli_shim.py &40SHIM_PID=$!4142alive() { [ -r "/proc/$1/stat" ] && [ "$(cut -d')' -f2 "/proc/$1/stat" | cut -d' ' -f2)" != Z ]; }43( while alive "$LLM_PID" && alive "$SHIM_PID"; do sleep 5; done44  echo '{"phase":"error","detail":"llama-server or the pi shim exited"}' >> "$M64_STATUS"45  kill -TERM $$ ) &4647exec /opt/gateway/bin/python3 /capsule/agent_gateway.py