m64_53ac9668fd7c / start.sh
24 lines, 1.2 KBraw
1#!/usr/bin/env bash2# model-for-opencode entrypoint. Runs inside the container; takes no arguments.3# The weights are at /weights/qwen3-4b (read-only); nothing is fetched at run time.4set -eu5echo '{"phase":"loading","detail":"loading Qwen3 4B into the GPU"}' >> "$M64_STATUS"67# Every setting is here, fixed: callers can't change them (a chat capsule only8# accepts messages, tools, tool_choice, response_format, max_tokens, stream, seed).9# --jinja use the model's own chat template: needed for tool calls,10# which is how opencode reads files and runs commands11# --ctx-size 32768 opencode's system prompt and tools take ~10k tokens12# -ngl 999 every layer on the GPU13# -fa on + q8_0 KV cache halves the KV cache's memory, so 32k fits in ~6 GB14# --host 0.0.0.0 inside the container's own network: only m64's front15# and gate can reach it16exec /app/llama-server \17 --model /weights/qwen3-4b/Qwen3-4B-Q4_K_M.gguf \18 --alias qwen3-4b \19 --jinja \20 --ctx-size 32768 \21 -ngl 999 \22 -fa on \23 --cache-type-k q8_0 --cache-type-v q8_0 \24 --host 0.0.0.0 --port "$M64_PORT"