motif64

m64_ff930d9fed8e / start.sh

41 lines, 2.3 KBraw
1#!/usr/bin/env bash2# pi-inkling2mini-pi-adapted-iq4nl-5090 entrypoint. Runs inside the container; takes no arguments.3#   127.0.0.1:9000     llama-server: 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/cache LD_LIBRARY_PATH=/opt/llama.cpp/build/bin10# 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/opt/llama.cpp/build/bin/llama-server \15    -m /weights/inkling/Inkling-2-Mini-IQ4_NL.gguf \16    --mmproj /weights/inkling/mmproj-Inkling-2-Mini-BF16.gguf \17    --lora /weights/lora/Inkling-2-Mini-pi-adapted-lora-F16.gguf \18    -c "$CTX" -np 1 -fa on --jinja \19    --alias inkling-2-mini-pi-adapted-iq4_nl --host 127.0.0.1 --port 9000 &20LLM_PID=$!2122export AGENT_HARNESS=pi23export AGENT_HARNESS_TITLE="pi coding agent 0.73.1 (badlogic/pi-mono)"24export AGENT_MODEL=inkling-2-mini-pi-adapted-iq4_nl UPSTREAM_MODEL=inkling-2-mini-pi-adapted-iq4_nl25export AGENT_CONTEXT=$CTX AGENT_VISION=126# The airbench checkup harness's settings (checkup.py output_cap / compaction_reserve): 32768 out at both27# windows, and pi compacts with a 65536-token reserve at 262144 (49152 at 131072).28export AGENT_MAX_OUT=3276829if [ "$CTX" -ge 262144 ]; then export AGENT_COMPACTION_RESERVE=65536; else export AGENT_COMPACTION_RESERVE=49152; fi30export LLM_BASE_URL=http://127.0.0.1:9000/v131export RELAY_URL=http://127.0.0.1:9000        # the gateway's health check: llama-server's /health32export NODE_USE_ENV_PROXY=1                   # web access, if granted, goes through the m64 gate33/opt/gateway/bin/python3 -u /capsule/cli_shim.py &34SHIM_PID=$!3536alive() { [ -r "/proc/$1/stat" ] && [ "$(cut -d')' -f2 "/proc/$1/stat" | cut -d' ' -f2)" != Z ]; }37( while alive "$LLM_PID" && alive "$SHIM_PID"; do sleep 5; done38  echo '{"phase":"error","detail":"llama-server or the pi shim exited"}' >> "$M64_STATUS"39  kill -TERM $$ ) &4041exec /opt/gateway/bin/python3 /capsule/agent_gateway.py