serve_remote.sh: pick ~/qwen-venv, refuse an old mlx-lm with a clear message; docs for mlx-lm 0.32.0 on the MacBook

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
Kral
2026-10-05 22:16:56 +02:00
parent 6984fc7917
commit 5c07026bbb
2 changed files with 24 additions and 14 deletions

View File

@@ -4,14 +4,14 @@
# MacBook awake as long as the server process lives (caffeinate -w <server pid>). Usage: ~/serve_remote.sh Stop: kill $(cat ~/qwen_server.pid)
MODEL="$HOME/models/Qwen3.8-27B-4bit"
[ -f "$MODEL/config.json" ] || { echo "model not found: $MODEL" >&2; exit 1; }
# the mlx_lm of the harness venv if the repo is on this Mac, else the one on PATH
if [ -x "$HOME/projects/abap-llm/harness/train/.venv/bin/mlx_lm.server" ]; then
SERVER="$HOME/projects/abap-llm/harness/train/.venv/bin/mlx_lm.server"
elif command -v mlx_lm.server >/dev/null 2>&1; then
SERVER="$(command -v mlx_lm.server)"
else
echo "mlx_lm.server not found (pip install mlx-lm==0.32.0)" >&2; exit 1
fi
# the mlx_lm server: $MLX_SERVER, else ~/qwen-venv (mlx-lm 0.32.0, see docs/remote-model.md), else the harness venv, else PATH
for c in "$MLX_SERVER" "$HOME/qwen-venv/bin/mlx_lm.server" "$HOME/projects/abap-llm/harness/train/.venv/bin/mlx_lm.server" "$(command -v mlx_lm.server)"; do
if [ -n "$c" ] && [ -x "$c" ]; then SERVER="$c"; break; fi
done
[ -n "$SERVER" ] || { echo "mlx_lm.server not found: create ~/qwen-venv with mlx-lm 0.32.0 (docs/remote-model.md)" >&2; exit 1; }
# the baseline flags need mlx-lm 0.32.x; an older server does not know them
"$SERVER" --help 2>&1 | grep -q -- "--prompt-cache-bytes" || { echo "$SERVER is too old (no --prompt-cache-bytes). Install mlx-lm 0.32.0 in ~/qwen-venv (docs/remote-model.md)" >&2; exit 1; }
echo "server: $SERVER"
"$SERVER" \
--model "$MODEL" \
--host 0.0.0.0 --port 8080 \