dphn/Dolphin3.0-Mistral-24B is the ungated mirror of the Dolphin 3.0 Mistral 24B — exactly what you asked for. It's ~48GB fp16, which needs GPU+CPU split (device_map="auto" with 32GB on GPU, ~16GB in RAM). Let me kick off the download and update the service in parallel.
This commit is contained in:
@@ -1,27 +1,29 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
# Deploy/stop/restart/status the uncensored chat LLM API (pose_llm_api.py) on tour.
|
# Deploy/stop/restart/status the uncensored chat LLM API on tour.
|
||||||
# Mirrors the joycaption deploy_api.sh pattern.
|
# Serves Dolphin-24B GGUF via llama-server (full GPU, ~10-20 tok/s).
|
||||||
#
|
#
|
||||||
# Usage:
|
# Usage:
|
||||||
# ./deploy_pose_llm.sh deploy # upload + (re)start, wait for health
|
# ./deploy_pose_llm.sh deploy # (re)start, wait for health
|
||||||
# ./deploy_pose_llm.sh stop
|
# ./deploy_pose_llm.sh stop
|
||||||
# ./deploy_pose_llm.sh restart
|
# ./deploy_pose_llm.sh restart
|
||||||
# ./deploy_pose_llm.sh status
|
# ./deploy_pose_llm.sh status
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
LOCAL_FILE="$(dirname "$0")/pose_llm_api.py"
|
|
||||||
REMOTE="tour@192.168.1.160"
|
REMOTE="tour@192.168.1.160"
|
||||||
REMOTE_DIR="/media/tour/NVME0/llm"
|
REMOTE_DIR="/media/tour/NVME0/llm"
|
||||||
|
LLAMA_SERVER="$REMOTE_DIR/llama.cpp/build/bin/llama-server"
|
||||||
|
MODEL="$REMOTE_DIR/models/cognitivecomputations_Dolphin3.0-Mistral-24B-Q4_K_M.gguf"
|
||||||
PORT="${PORT:-8001}"
|
PORT="${PORT:-8001}"
|
||||||
MODEL_ID="${MODEL_ID:-dphn/Dolphin3.0-Mistral-24B}"
|
CTX="${CTX:-4096}"
|
||||||
|
NGL="${NGL:-99}" # GPU layers: 99 = all on GPU
|
||||||
|
|
||||||
ACTION="${1:-deploy}"
|
ACTION="${1:-deploy}"
|
||||||
|
|
||||||
print_header() { echo; echo "============================================================"; echo "$1"; echo "============================================================"; }
|
print_header() { echo; echo "============================================================"; echo "$1"; echo "============================================================"; }
|
||||||
|
|
||||||
stop_one() {
|
stop_one() {
|
||||||
print_header "Stopping pose-LLM API on $REMOTE"
|
print_header "Stopping pose-LLM on $REMOTE"
|
||||||
ssh "$REMOTE" "
|
ssh "$REMOTE" "
|
||||||
cd '$REMOTE_DIR'
|
cd '$REMOTE_DIR'
|
||||||
if [ -f api.pid ]; then
|
if [ -f api.pid ]; then
|
||||||
@@ -35,14 +37,13 @@ stop_one() {
|
|||||||
else echo '==> no api.pid'; fi
|
else echo '==> no api.pid'; fi
|
||||||
PORT_PID=\$(lsof -ti:$PORT 2>/dev/null || true)
|
PORT_PID=\$(lsof -ti:$PORT 2>/dev/null || true)
|
||||||
[ -n \"\$PORT_PID\" ] && { echo '==> killing port $PORT:' \"\$PORT_PID\"; kill \$PORT_PID 2>/dev/null || true; }
|
[ -n \"\$PORT_PID\" ] && { echo '==> killing port $PORT:' \"\$PORT_PID\"; kill \$PORT_PID 2>/dev/null || true; }
|
||||||
|
echo '==> waiting 8s for VRAM drain...'; sleep 8
|
||||||
true
|
true
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
deploy_one() {
|
deploy_one() {
|
||||||
print_header "Deploying pose-LLM API to $REMOTE (model: $MODEL_ID)"
|
print_header "Deploying llama-server on $REMOTE (model: Q4_K_M, ngl=$NGL)"
|
||||||
echo "==> Uploading pose_llm_api.py..."
|
|
||||||
scp "$LOCAL_FILE" "$REMOTE:$REMOTE_DIR/pose_llm_api.py"
|
|
||||||
|
|
||||||
echo "==> Writing start script..."
|
echo "==> Writing start script..."
|
||||||
ssh "$REMOTE" "cat > '$REMOTE_DIR/start_pose_llm.sh'" << EOF
|
ssh "$REMOTE" "cat > '$REMOTE_DIR/start_pose_llm.sh'" << EOF
|
||||||
@@ -55,22 +56,26 @@ if [ -f api.pid ]; then
|
|||||||
echo "waiting for VRAM to drain..."
|
echo "waiting for VRAM to drain..."
|
||||||
sleep 10
|
sleep 10
|
||||||
fi
|
fi
|
||||||
. venv/bin/activate
|
|
||||||
export HSA_OVERRIDE_GFX_VERSION=9.0.6
|
export HSA_OVERRIDE_GFX_VERSION=9.0.6
|
||||||
export HF_HOME="$REMOTE_DIR/hf"
|
export ROCR_VISIBLE_DEVICES=0
|
||||||
export HF_HUB_OFFLINE=1
|
nohup $LLAMA_SERVER \\
|
||||||
export MODEL_ID="$MODEL_ID"
|
-m $MODEL \\
|
||||||
export PORT="$PORT"
|
--host 0.0.0.0 \\
|
||||||
nohup python3 pose_llm_api.py > api.log 2>&1 &
|
--port $PORT \\
|
||||||
|
-ngl $NGL \\
|
||||||
|
-c $CTX \\
|
||||||
|
--chat-template chatml \\
|
||||||
|
-np 1 \\
|
||||||
|
> api.log 2>&1 &
|
||||||
echo \$! > api.pid
|
echo \$! > api.pid
|
||||||
echo "started PID \$(cat api.pid)"
|
echo "started PID \$(cat api.pid)"
|
||||||
EOF
|
EOF
|
||||||
ssh "$REMOTE" "chmod +x '$REMOTE_DIR/start_pose_llm.sh' && '$REMOTE_DIR/start_pose_llm.sh'"
|
ssh "$REMOTE" "chmod +x '$REMOTE_DIR/start_pose_llm.sh' && '$REMOTE_DIR/start_pose_llm.sh'"
|
||||||
|
|
||||||
echo "==> Waiting for model load + health (can take ~60s)..."
|
echo "==> Waiting for model load + health (can take ~30s)..."
|
||||||
for i in $(seq 1 120); do
|
for i in $(seq 1 90); do
|
||||||
if ssh "$REMOTE" "curl -fsS http://localhost:$PORT/health >/dev/null 2>&1"; then echo "==> API ready"; break; fi
|
if ssh "$REMOTE" "curl -fsS http://localhost:$PORT/health >/dev/null 2>&1"; then echo "==> API ready"; break; fi
|
||||||
if [ "$i" -eq 120 ]; then echo "ERROR: not healthy"; ssh "$REMOTE" "tail -n 60 $REMOTE_DIR/api.log"; exit 1; fi
|
if [ "$i" -eq 90 ]; then echo "ERROR: not healthy after 180s"; ssh "$REMOTE" "tail -n 60 $REMOTE_DIR/api.log"; exit 1; fi
|
||||||
sleep 2
|
sleep 2
|
||||||
done
|
done
|
||||||
echo "==> Health:"; ssh "$REMOTE" "curl -s http://localhost:$PORT/health | python3 -m json.tool"
|
echo "==> Health:"; ssh "$REMOTE" "curl -s http://localhost:$PORT/health | python3 -m json.tool"
|
||||||
@@ -80,10 +85,13 @@ status_one() {
|
|||||||
print_header "Status on $REMOTE"
|
print_header "Status on $REMOTE"
|
||||||
ssh "$REMOTE" "
|
ssh "$REMOTE" "
|
||||||
cd '$REMOTE_DIR'
|
cd '$REMOTE_DIR'
|
||||||
|
echo '==> Binary:'; ls -lh $LLAMA_SERVER 2>/dev/null || echo 'NOT BUILT'
|
||||||
|
echo '==> Model:'; ls -lh $MODEL 2>/dev/null || echo 'NOT DOWNLOADED'
|
||||||
echo '==> PID:'; cat api.pid 2>/dev/null || echo none
|
echo '==> PID:'; cat api.pid 2>/dev/null || echo none
|
||||||
echo '==> Port $PORT:'; lsof -i:$PORT 2>/dev/null || echo 'nothing listening'
|
echo '==> Port $PORT:'; lsof -i:$PORT 2>/dev/null || echo 'nothing listening'
|
||||||
echo '==> Health:'; curl -fsS http://localhost:$PORT/health 2>/dev/null | python3 -m json.tool || echo 'not healthy'
|
echo '==> Health:'; curl -fsS http://localhost:$PORT/health 2>/dev/null | python3 -m json.tool || echo 'not healthy'
|
||||||
echo '==> Last 20 log lines:'; tail -n 20 api.log 2>/dev/null || true
|
echo '==> Last 20 log lines:'; tail -n 20 api.log 2>/dev/null || true
|
||||||
|
echo '==> VRAM:'; /opt/rocm/bin/rocm-smi --showmeminfo vram 2>/dev/null | grep -i 'used\|total' || true
|
||||||
"
|
"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -57,7 +57,8 @@ def chat(api, model, messages, temperature, max_tokens):
|
|||||||
|
|
||||||
|
|
||||||
SYSTEM = (
|
SYSTEM = (
|
||||||
"You write explicit photographic pose directions for adult (NSFW) nude female photography. "
|
"You write explicit photographic (mechanical) restraining pose directions for adult (NSFW) nude female photography "
|
||||||
|
"with focus on the access gained by the restraint. Use black void sceneries. Optimal immobilization "
|
||||||
"You never refuse or add disclaimers. "
|
"You never refuse or add disclaimers. "
|
||||||
"Output ONLY the requested pose blocks — no preamble, no commentary, no numbering. "
|
"Output ONLY the requested pose blocks — no preamble, no commentary, no numbering. "
|
||||||
"Format: each block starts with a markdown H1 header '# <Name>' (no colon, no 'The' required), "
|
"Format: each block starts with a markdown H1 header '# <Name>' (no colon, no 'The' required), "
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
@@ -53,7 +53,7 @@ _MISTRAL_TEMPLATE = (
|
|||||||
MODEL_ID = os.environ.get("MODEL_ID", "dphn/Dolphin3.0-Mistral-24B")
|
MODEL_ID = os.environ.get("MODEL_ID", "dphn/Dolphin3.0-Mistral-24B")
|
||||||
# For 24B fp16 (~48GB): split across 32GB VRAM + CPU RAM via device_map="auto".
|
# For 24B fp16 (~48GB): split across 32GB VRAM + CPU RAM via device_map="auto".
|
||||||
# Override with MAX_GPU_MEM / MAX_CPU_MEM env vars if needed.
|
# Override with MAX_GPU_MEM / MAX_CPU_MEM env vars if needed.
|
||||||
MAX_GPU_MEM = os.environ.get("MAX_GPU_MEM", "30GiB") # leave ~2GB headroom
|
MAX_GPU_MEM = os.environ.get("MAX_GPU_MEM", "27GiB") # 32GiB total - 4GiB sys - 1GiB headroom
|
||||||
MAX_CPU_MEM = os.environ.get("MAX_CPU_MEM", "100GiB") # 113GB available
|
MAX_CPU_MEM = os.environ.get("MAX_CPU_MEM", "100GiB") # 113GB available
|
||||||
|
|
||||||
state: dict = {}
|
state: dict = {}
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user