1
This commit is contained in:
Executable
+30
@@ -0,0 +1,30 @@
|
||||
#!/bin/bash
|
||||
# 启动本地 MLX 模型服务:chat + embedding 均由 oMLX(18080) 提供
|
||||
# chat=Qwen3.5-9B-MLX-4bit(4-bit),embedding=BGE-M3(oMLX 原生 BERT 系支持)
|
||||
# 用法: ./scripts/start_models.sh
|
||||
set -u
|
||||
cd "$(dirname "$0")/.."
|
||||
ROOT=$(pwd)
|
||||
VENV="$ROOT/.venv"
|
||||
LOG_DIR="$HOME/.omlx/logs"
|
||||
CACHE_DIR="$HOME/.omlx/cache"
|
||||
mkdir -p "$LOG_DIR" "$CACHE_DIR"
|
||||
|
||||
# oMLX 模型目录:chat(Qwen3.5-9B-MLX-4bit)+ embedding(bge-m3)均为实体目录,oMLX 按目录扫描注册模型
|
||||
OMLX_MODEL_DIR="$ROOT/models/mlx/omlx"
|
||||
|
||||
if lsof -iTCP:18080 -sTCP:LISTEN >/dev/null 2>&1; then
|
||||
echo "[skip] oMLX 18080 已被占用"
|
||||
else
|
||||
# 内存策略写在 ~/.omlx/settings.json(custom 上限 14GB),
|
||||
# CLI 不加 --memory-guard,避免覆盖 settings.json 的 custom 配置
|
||||
nohup "$VENV/bin/omlx" serve \
|
||||
--model-dir "$OMLX_MODEL_DIR" \
|
||||
--host 127.0.0.1 --port 18080 \
|
||||
--paged-ssd-cache-dir "$CACHE_DIR/omlx-cache" \
|
||||
--max-concurrent-requests 8 \
|
||||
--log-level info >> "$LOG_DIR/mlx-chat.log" 2>&1 &
|
||||
echo "[start] oMLX chat+embedding -> 127.0.0.1:18080 (pid $!)"
|
||||
fi
|
||||
|
||||
echo "日志: $LOG_DIR/mlx-chat.log"
|
||||
Executable
+9
@@ -0,0 +1,9 @@
|
||||
#!/bin/bash
|
||||
# 停止本地 MLX 模型服务(oMLX:chat + embedding 一体)
|
||||
# 用法: ./scripts/stop_models.sh
|
||||
if pgrep -f "[o]mlx-server" >/dev/null 2>&1; then
|
||||
pkill -f "[o]mlx-server"
|
||||
echo "[stop] oMLX 18080 (chat+embedding)"
|
||||
else
|
||||
echo "oMLX 未在运行"
|
||||
fi
|
||||
Reference in New Issue
Block a user