-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathrun_vllm_omni.sh
More file actions
executable file
·56 lines (51 loc) · 2.26 KB
/
Copy pathrun_vllm_omni.sh
File metadata and controls
executable file
·56 lines (51 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/usr/bin/env bash
# Launch (or resume) the vLLM-Omni S2-pro backend container that server.py proxies.
# The image `vllm-omni-fish:local` is the official vllm/vllm-omni:v0.22.0 plus the
# DAC codec's deps (descript-audio-codec stack) installed under a constraints file
# so vLLM's torch 2.11 / transformers 5.8 / sm_120 kernels stay intact. fish_speech
# source is mounted (the codec imports it) via PYTHONPATH.
set -euo pipefail
DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
NAME=vllm_omni_s2
IMAGE=vllm-omni-fish:local
PORT=8091
if [ ! -d "$DIR/../models/s2-pro" ]; then
echo "[vllm-omni] error: model weights not found at $DIR/../models/s2-pro" >&2
echo " download them (see README, huggingface.co/fishaudio/s2-pro) and retry." >&2
exit 1
fi
MODELS="$(cd "$DIR/../models" && pwd)"
# If a container already exists but was built from a DIFFERENT image than the
# current $IMAGE (i.e. you rebuilt vllm-omni-fish:local), recreate it — otherwise
# `docker start` below would silently resurrect the old image and old serve args.
if docker inspect "$NAME" >/dev/null 2>&1; then
want="$(docker inspect -f '{{.Id}}' "$IMAGE" 2>/dev/null || true)"
have="$(docker inspect -f '{{.Image}}' "$NAME" 2>/dev/null || true)"
if [ -n "$want" ] && [ "$want" != "$have" ]; then
echo "[vllm-omni] image changed since this container was created — recreating..."
docker rm -f "$NAME" >/dev/null
fi
fi
if docker ps --format '{{.Names}}' | grep -q "^${NAME}$"; then
echo "[vllm-omni] already running"
elif docker ps -a --format '{{.Names}}' | grep -q "^${NAME}$"; then
echo "[vllm-omni] starting existing container..."
docker start "$NAME" >/dev/null
else
echo "[vllm-omni] creating container from $IMAGE ..."
docker run -d --name "$NAME" --gpus all -p ${PORT}:${PORT} \
-v "$MODELS":/models:ro \
-v "$DIR":/fishaudio:ro \
-e PYTHONPATH=/fishaudio \
--entrypoint vllm \
"$IMAGE" \
serve /models/s2-pro --omni --port ${PORT} >/dev/null
fi
echo -n "[vllm-omni] waiting for API on :${PORT}"
until curl -s -m3 "http://127.0.0.1:${PORT}/v1/models" >/dev/null 2>&1; do
if ! docker ps --format '{{.Names}}' | grep -q "^${NAME}$"; then
echo " — container exited:"; docker logs --tail 30 "$NAME"; exit 1
fi
echo -n "."; sleep 3
done
echo " ready."