motif64

m64_d2b244dacf69 / start.sh

45 lines, 2.7 KBraw
1#!/usr/bin/env bash2# pi17-qwen38-27b-ud-q5km-mtp-strixhalo entrypoint. Runs inside the container; takes no arguments.3#   127.0.0.1:9000     llama-server: Qwen3.8-27B UD-Q5_K_M (Unsloth), 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 context window: the model's full 262144 by default.11CTX=${CONTEXT:-262144}1213echo '{"phase":"loading","detail":"llama.cpp: loading Qwen3.8-27B and its MTP head"}' >> "$M64_STATUS"14# Measured on this GPU (Vulkan, RADV), 1500 tokens of code at temperature 1.0: 10.7 t/s alone, 30 t/s with the MTP15# head drafting 3 tokens, 34 t/s drafting 5. Prompts read at ~294 t/s (-ub 2048 and 1024 are equal for this dense model).16# Sampling: Qwen's thinking-mode values from the model card (temp 1.0, top-p 0.95, top-k 20, no presence penalty).17/opt/llama/bin/llama-server \18    -m /weights/qwen/Qwen3.8-27B-UD-Q5_K_M.gguf \19    --mmproj /weights/qwen/mmproj-BF16.gguf \20    --spec-type draft-mtp -md /weights/qwen/MTP/mtp-Qwen3.8-27B-Q4_0.gguf --spec-draft-n-max 5 \21    -c "$CTX" -np 1 -ngl 999 -fa on -ctk q8_0 -ctv q8_0 -b 2048 -ub 2048 -lm none --jinja \22    --temp 1.0 --top-k 20 --top-p 0.95 --min-p 0 --presence-penalty 0 \23    --no-ui --metrics --alias qwen3.8-27b-ud-q5_k_m --host 127.0.0.1 --port 9000 &24LLM_PID=$!2526export AGENT_HARNESS=pi27export AGENT_HARNESS_TITLE="pi coding agent 1.7.0 (earendil-works/pi)"28export AGENT_MODEL=qwen3.8-27b-ud-q5_k_m UPSTREAM_MODEL=qwen3.8-27b-ud-q5_k_m29export AGENT_CONTEXT=$CTX AGENT_VISION=130# The airbench checkup harness's settings (checkup.py output_cap / compaction_reserve): 32768 out at both31# windows, and pi compacts with a 65536-token reserve at 262144 (49152 at 131072).32export AGENT_MAX_OUT=3276833if [ "$CTX" -ge 262144 ]; then export AGENT_COMPACTION_RESERVE=65536; else export AGENT_COMPACTION_RESERVE=49152; fi34export LLM_BASE_URL=http://127.0.0.1:9000/v135export RELAY_URL=http://127.0.0.1:9000        # the gateway's health check: llama-server's /health36export NODE_USE_ENV_PROXY=1                   # web access, if granted, goes through the m64 gate37/opt/gateway/bin/python3 -u /capsule/cli_shim.py &38SHIM_PID=$!3940alive() { [ -r "/proc/$1/stat" ] && [ "$(cut -d')' -f2 "/proc/$1/stat" | cut -d' ' -f2)" != Z ]; }41( while alive "$LLM_PID" && alive "$SHIM_PID"; do sleep 5; done42  echo '{"phase":"error","detail":"llama-server or the pi shim exited"}' >> "$M64_STATUS"43  kill -TERM $$ ) &4445exec /opt/gateway/bin/python3 /capsule/agent_gateway.py