跳转至

VibeVoice Gradio 演示设置指南

端到端说明,用于部署 VibeVoice ASR 服务器并启动 Gradio Web 演示。

前提条件

  • 支持 CUDA 的 GPU
  • 支持 GPU 的 Docker(nvidia-docker)
  • 已在本地克隆 VibeVoice 仓库
git clone https://github.com/microsoft/VibeVoice.git
cd VibeVoice

步骤 1 — 启动 ASR 服务器

启动一个运行 vLLM ASR 服务器的 Docker 容器。启动脚本会自动处理一切(系统依赖、pip 安装、模型下载、tokenizer 生成、服务器启动)。

单 GPU(默认)

docker run -d --gpus '"device=0"' --name vibevoice-asr-demo \
  --ipc=host \
  -p 6001:6001 \
  -e VIBEVOICE_FFMPEG_MAX_CONCURRENCY=64 \
  -e PYTORCH_ALLOC_CONF=expandable_segments:True \
  -v $(pwd):/app \
  -w /app \
  --entrypoint bash \
  vllm/vllm-openai:v0.14.1 \
  -c "python3 /app/vllm_plugin/scripts/start_server.py --port 6001"

多 GPU + Data Parallel(负载均衡)

运行 4 个独立副本,每个 GPU 一个。vLLM 会自动分发请求:

docker run -d --gpus '"device=0,1,2,3"' --name vibevoice-asr-demo \
  --ipc=host \
  -p 6001:6001 \
  -e VIBEVOICE_FFMPEG_MAX_CONCURRENCY=64 \
  -e PYTORCH_ALLOC_CONF=expandable_segments:True \
  -v $(pwd):/app \
  -w /app \
  --entrypoint bash \
  vllm/vllm-openai:v0.14.1 \
  -c "python3 /app/vllm_plugin/scripts/start_server.py --port 6001 --dp 4"

提示:使用 --dp N 进行 N 路 Data Parallel(吞吐量扩展)。使用 --tp N 进行 Tensor Parallel(大型模型)。详见 docs/vibevoice-vllm-asr.md。

查看日志

docker logs -f vibevoice-asr-demo

请等待,直到看到 Application startup complete. — 这表示服务器已就绪。


步骤 2 — 验证服务器

# Check the model is loaded
curl http://localhost:6001/v1/models

预期输出:

{
  "data": [{ "id": "vibevoice", ... }]
}

使用音频文件快速测试

docker exec -it vibevoice-asr-demo \
  python3 /app/vllm_plugin/tests/test_api.py /app/en-Alice_woman.wav \
  --url http://localhost:6001

步骤 3 — 启动 Gradio 演示

在容器内安装 tmux(使其保持运行)

docker exec vibevoice-asr-demo apt-get install -y tmux

在 tmux 中启动 Gradio

docker exec vibevoice-asr-demo bash -c \
  "PYTHONUNBUFFERED=1 tmux new-session -d -s gradio \
  'PYTHONUNBUFFERED=1 python3 /app/vllm_plugin/scripts/gradio_asr_demo_api_video.py \
  --api_url http://localhost:6001 --share \
  2>&1 | tee /tmp/gradio.log'"

等待约 20 秒,然后:

docker exec vibevoice-asr-demo cat /tmp/gradio.log

你应该会看到:

✅ Connected to API: http://localhost:6001 | Model: vibevoice
🚀 Starting VibeVoice ASR Demo
* Running on local URL:  http://0.0.0.0:7860
* Running on public URL: https://xxxxxx.gradio.live

gradio.live 链接可公开访问(有效期为 1 周)。

Gradio 选项

标志 描述 默认值
--api_url URL vLLM 服务器 URL http://localhost:8000
--share 创建公开的 Gradio 链接 关闭
--port PORT 本地 Gradio 端口 7860
--cloudflared 使用 Cloudflare 隧道代替 Gradio share 关闭
--max_video_size MB 最大上传视频大小 50

管理服务

停止 Gradio(保持 ASR 服务器运行)

docker exec vibevoice-asr-demo tmux kill-session -t gradio

重启 Gradio

重新运行步骤 3 中的 tmux 命令。

停止一切

docker stop vibevoice-asr-demo
docker rm vibevoice-asr-demo

示例:在 GPU 0 上使用端口 6001 进行完整设置

# 1. Start server
docker run -d --gpus '"device=0"' --name vibevoice-asr-demo \
  --ipc=host -p 6001:6001 \
  -e VIBEVOICE_FFMPEG_MAX_CONCURRENCY=64 \
  -e PYTORCH_ALLOC_CONF=expandable_segments:True \
  -v $(pwd):/app -w /app \
  --entrypoint bash \
  vllm/vllm-openai:v0.14.1 \
  -c "python3 /app/vllm_plugin/scripts/start_server.py --port 6001"

# 2. Wait for startup (~2 min), then verify
docker logs -f vibevoice-asr-demo  # wait for "Application startup complete."
curl http://localhost:6001/v1/models

# 3. Install tmux and launch Gradio
docker exec vibevoice-asr-demo apt-get install -y tmux
docker exec vibevoice-asr-demo bash -c \
  "PYTHONUNBUFFERED=1 tmux new-session -d -s gradio \
  'PYTHONUNBUFFERED=1 python3 /app/vllm_plugin/scripts/gradio_asr_demo_api_video.py \
  --api_url http://localhost:6001 --share \
  2>&1 | tee /tmp/gradio.log'"

# 4. Get the public link
sleep 20 && docker exec vibevoice-asr-demo cat /tmp/gradio.log

故障排除

问题 解决方法
CUDA out of memory 使用其他 GPU(device=X),或在 start_server.py 中调低 --gpu-memory-utilization 0.7
Gradio 日志为空 等待更长时间(约 30 秒);Gradio 会缓冲输出。请按上文所示使用 PYTHONUNBUFFERED=1
Port already in use 选择其他端口,或停止现有容器:docker stop <name> && docker rm <name>
Share 链接显示 "No interface" Gradio 仍在加载。请等待日志中出现 Application startup complete
tmux: command not found 先运行 docker exec <container> apt-get install -y tmux

本页原文 Markdown:在 AtomGit 查看·内容源自开源项目 vib/VibeVoice