#!/usr/bin/env bash # pi17-inkling2mini-iq4nl-strixhalo entrypoint. Runs inside the container; takes no arguments. # 127.0.0.1:9000 llama-server (llama.cpp 75d911f, Vulkan): Inkling-2-Mini IQ4_NL (ggml-org), CONTEXT ctx (default 262144) # 127.0.0.1:4096 cli_shim.py: `pi -p --mode json` once per prompt # 0.0.0.0:$M64_PORT agent_gateway.py: the agent.session API set -eu export HOME=/scratch/home WORK_DIR=/scratch/work SHIM_HOMES=/scratch/homes mkdir -p "$HOME" "$WORK_DIR/sessions" "$SHIM_HOMES" /scratch/cache export XDG_CACHE_HOME=/scratch/cache # The context window: the model's full 262144 by default (the adapter's card evaluated at 131072: CONTEXT=131072). CTX=${CONTEXT:-262144} echo '{"phase":"loading","detail":"llama.cpp: loading Inkling-2-Mini"}' >> "$M64_STATUS" # Measured on this GPU with llama-bench (Vulkan, RADV): 33 t/s generation, and -ub 2048 reads prompts a little faster # 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 depth # (29 vs 28 t/s) and 64 GiB holds f16 at 262144. Weights read once and offloaded whole (-lm none). Sampling: the GGUF's # own defaults, as on the 5090 (greedy decoding sent Inkling into a degenerate loop). /opt/llama/bin/llama-server \ -m /weights/inkling/Inkling-2-Mini-IQ4_NL.gguf \ --mmproj /weights/inkling/mmproj-Inkling-2-Mini-BF16.gguf \ -c "$CTX" -np 1 -ngl 999 -fa on -b 2048 -ub 2048 -lm none --jinja --no-ui --metrics \ --alias inkling-2-mini-iq4_nl --host 127.0.0.1 --port 9000 & LLM_PID=$! export AGENT_HARNESS=pi export AGENT_HARNESS_TITLE="pi coding agent 1.7.0 (earendil-works/pi)" export AGENT_MODEL=inkling-2-mini-iq4_nl UPSTREAM_MODEL=inkling-2-mini-iq4_nl export AGENT_CONTEXT=$CTX AGENT_VISION=1 # The airbench checkup harness's settings (checkup.py output_cap / compaction_reserve): 32768 out at both # windows, and pi compacts with a 65536-token reserve at 262144 (49152 at 131072). export AGENT_MAX_OUT=32768 if [ "$CTX" -ge 262144 ]; then export AGENT_COMPACTION_RESERVE=65536; else export AGENT_COMPACTION_RESERVE=49152; fi export LLM_BASE_URL=http://127.0.0.1:9000/v1 export RELAY_URL=http://127.0.0.1:9000 # the gateway's health check: llama-server's /health export NODE_USE_ENV_PROXY=1 # web access, if granted, goes through the m64 gate /opt/gateway/bin/python3 -u /capsule/cli_shim.py & SHIM_PID=$! alive() { [ -r "/proc/$1/stat" ] && [ "$(cut -d')' -f2 "/proc/$1/stat" | cut -d' ' -f2)" != Z ]; } ( while alive "$LLM_PID" && alive "$SHIM_PID"; do sleep 5; done echo '{"phase":"error","detail":"llama-server or the pi shim exited"}' >> "$M64_STATUS" kill -TERM $$ ) & exec /opt/gateway/bin/python3 /capsule/agent_gateway.py