motif64

m64_7a25f24a3604 / start.sh

45 lines, 2.8 KBraw
1#!/usr/bin/env bash2# pi17-inkling2mini-pi-adapted-iq4nl-strixhalo entrypoint. Runs inside the container; takes no arguments.3#   127.0.0.1:9000     llama-server (llama.cpp 75d911f, Vulkan): Inkling-2-Mini IQ4_NL (ggml-org) + the pi LoRA (harness-hub), 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 (the adapter's card evaluated at 131072: CONTEXT=131072).11CTX=${CONTEXT:-262144}1213echo '{"phase":"loading","detail":"llama.cpp: loading Inkling-2-Mini"}' >> "$M64_STATUS"14# Measured on this GPU with llama-bench (Vulkan, RADV): 33 t/s generation, and -ub 2048 reads prompts a little faster15# than 512/1024 (616 vs 586/607 t/s at 4096); the f16 KV cache stays (as on the 5090): q8_0 is no faster at 32K depth16# (29 vs 28 t/s) and 64 GiB holds f16 at 262144. Weights read once and offloaded whole (-lm none). Sampling: the GGUF's17# own defaults, as on the 5090 (greedy decoding sent Inkling into a degenerate loop).18/opt/llama/bin/llama-server \19    -m /weights/inkling/Inkling-2-Mini-IQ4_NL.gguf \20    --mmproj /weights/inkling/mmproj-Inkling-2-Mini-BF16.gguf \21    --lora /weights/lora/Inkling-2-Mini-pi-adapted-lora-F16.gguf \22    -c "$CTX" -np 1 -ngl 999 -fa on -b 2048 -ub 2048 -lm none --jinja --no-ui --metrics \23    --alias inkling-2-mini-pi-adapted-iq4_nl --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=inkling-2-mini-pi-adapted-iq4_nl UPSTREAM_MODEL=inkling-2-mini-pi-adapted-iq4_nl29export 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