Kleineres Modell
This commit is contained in:
71
docker/entrypoint.sh
Executable file
71
docker/entrypoint.sh
Executable file
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
# Container-Entrypoint: startet den vLLM-Omni TTS-Server und feuert nach
|
||||
# Erreichen von /health einmalig einen Warmup-Request ab. Dieser absorbiert
|
||||
# die einmalige torch.compile/CUDA-Graph-Kompilierung (~38 s), damit kein
|
||||
# echter Nutzer-Request sie je trifft. Läuft bei JEDEM Containerstart
|
||||
# (Reboot, Crash-Restart, manuell).
|
||||
set -e
|
||||
|
||||
MODEL="${QWEN3_TTS_MODEL:-Qwen/Qwen3-TTS-12Hz-1.7B-CustomVoice}"
|
||||
PORT=8091
|
||||
UI_PORT=8092
|
||||
WS_LOG_PORT=8094
|
||||
|
||||
# --- Runtime-Patches fuer Qwen3-TTS anwenden ---
|
||||
if [ -f /patch_qwen3_tts_runtime.py ]; then
|
||||
python3 /patch_qwen3_tts_runtime.py
|
||||
fi
|
||||
|
||||
# --- Browser-UI im Container starten ---
|
||||
if [ -f /voice_clone_ui.py ]; then
|
||||
python3 /voice_clone_ui.py \
|
||||
--host 0.0.0.0 \
|
||||
--port "$UI_PORT" \
|
||||
--api-base "http://localhost:${PORT}" \
|
||||
--clone-api-base "http://qwen3-tts-clone:8093" \
|
||||
--model "$MODEL" &
|
||||
UI_PID=$!
|
||||
echo "[ui] Voice-Cloning-UI laeuft auf Port ${UI_PORT}"
|
||||
fi
|
||||
|
||||
# --- WebSocket-Logging-Proxy im Container starten ---
|
||||
if [ -f /ws_log_proxy.py ]; then
|
||||
python3 /ws_log_proxy.py \
|
||||
--host 0.0.0.0 \
|
||||
--port "$WS_LOG_PORT" \
|
||||
--upstream "ws://localhost:${PORT}/v1/audio/speech/stream" &
|
||||
WS_LOG_PID=$!
|
||||
echo "[ws-log] Proxy laeuft auf Port ${WS_LOG_PORT}"
|
||||
fi
|
||||
|
||||
# --- Server im Hintergrund starten ---
|
||||
vllm-omni serve "$MODEL" \
|
||||
--omni \
|
||||
--host 0.0.0.0 \
|
||||
--port "$PORT" \
|
||||
--deploy-config /deploy/qwen3_tts.yaml \
|
||||
--gpu-memory-utilization 0.10 \
|
||||
--trust-remote-code &
|
||||
SERVER_PID=$!
|
||||
|
||||
# --- Warmup im Hintergrund, sobald der Server gesund ist ---
|
||||
(
|
||||
for _ in $(seq 1 150); do
|
||||
if curl -sf "http://localhost:${PORT}/health" >/dev/null 2>&1; then
|
||||
echo "[warmup] Server gesund — sende Warmup-Request (kompiliert CUDA-Graphen)..."
|
||||
t0=$SECONDS
|
||||
curl -sf -X POST "http://localhost:${PORT}/v1/audio/speech" \
|
||||
-H 'Content-Type: application/json' \
|
||||
-d "{\"model\":\"${MODEL}\",\"input\":\"System wird aufgewärmt.\",\"voice\":\"Ryan\",\"language\":\"German\",\"response_format\":\"wav\"}" \
|
||||
-o /dev/null \
|
||||
&& echo "[warmup] fertig nach $(( SECONDS - t0 ))s — Server ist jetzt heiß." \
|
||||
|| echo "[warmup] fehlgeschlagen (Server läuft trotzdem)."
|
||||
break
|
||||
fi
|
||||
sleep 2
|
||||
done
|
||||
) &
|
||||
|
||||
# --- Auf den Server-Prozess warten (PID 1 Signalweiterleitung) ---
|
||||
trap 'kill "$SERVER_PID" "${UI_PID:-}" "${WS_LOG_PID:-}" 2>/dev/null || true' TERM INT
|
||||
wait "$SERVER_PID"
|
||||
Reference in New Issue
Block a user