MLX server: prompt cache limit (memory); restart after the T01 test

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_014aUaQeLnwbb1zTpN7kHeat
This commit is contained in:
Kral
2026-10-03 18:47:03 +02:00
parent 81d8cf6f99
commit d83a39a8d8
3 changed files with 14 additions and 0 deletions

11
train/restart_server.sh Executable file
View File

@@ -0,0 +1,11 @@
#!/bin/sh
# Restart the MLX server with the prompt cache limit when the T01 test (PID 59414) has ended,
# before the night chain starts the baseline. Log: runs/stage1/restart_server.log
cd "$(dirname "$0")/.."
while kill -0 59414 2>/dev/null; do sleep 20; done
echo "$(date '+%F %T') T01 test ended; restart server"
kill 59352; while kill -0 59352 2>/dev/null; do sleep 2; done
nohup train/serve.sh > runs/stage1/server.log 2>&1 &
echo "$(date '+%F %T') new server PID $!"
i=0; until curl -s -m 2 http://127.0.0.1:8080/v1/models >/dev/null 2>&1 || [ $i -ge 60 ]; do sleep 5; i=$((i+1)); done
echo "$(date '+%F %T') server ready: $(curl -s -m 2 http://127.0.0.1:8080/v1/models | head -c 80)"

View File

@@ -1,11 +1,13 @@
#!/bin/sh
# Serve the base model (no adapter) with mlx_lm.server. Settings: train/README.md.
# Usage: train/serve.sh [--adapter-path PATH]
# Prompt cache limit: without it the cache grew to 7.9 GB in 15 min (2026-10-03); A4H needs 22 GB.
cd "$(dirname "$0")/.."
exec train/.venv/bin/mlx_lm.server \
--model "$HOME/models/Qwen3.8-27B-4bit" \
--host 127.0.0.1 --port 8080 \
--temp 0.2 --top-p 0.95 --top-k 20 --min-p 0 \
--max-tokens 32768 \
--prompt-cache-size 4 --prompt-cache-bytes 6000000000 \
--chat-template-args '{"enable_thinking": true, "reasoning_effort": "medium"}' \
"$@"