feat(dia): two-instance Dia2 deployment (dia2-1b + dia2-2b)

The devnen wrapper is single-model and ignores the OpenAI model field, so
offering both Dia2 models to asset-engine as real per-request choices means
one fixed-model instance per model. Rework the dia stack to run two services
from a dia2-capable image:
  * dia2-2b (:8200, best quality), dia2-1b (:8202, streaming) — both GPU 0
  * each pins its model via a mounted /opt/docker/conf/dia2-*/config.yaml
Retire the legacy Dia 1.6B service.

New dia2-image/Dockerfile builds local/dia:v2 = upstream devnen wrapper +
the dia2 package (copied into site-packages; its pyproject build backend
yields an empty UNKNOWN wheel under the base's old setuptools) + the three
missing runtime deps (transformers/sphn/whisper-timestamped); torch 2.12 /
numpy 2.2 in the base already satisfy Dia2. Both instances verified
end-to-end (HTTP 200, Ogg/Opus 24 kHz).
This commit is contained in:
vh
2026-05-31 14:41:11 -07:00
parent 02b26f45a6
commit 3139e81e8a
3 changed files with 115 additions and 85 deletions
+55 -41
View File
@@ -1,67 +1,81 @@
# Dia / Dia2 (Nari Labs' dialogue-focused TTS) served via
# devnen/Dia-TTS-Server — the same OpenAI-compat wrapper author as our
# chatterbox stack, with multi-model support for the Dia 2 family
# (Dia 1.6B / Dia2-1B / Dia2-2B), switchable from the Web UI.
# Dia2 (Nari Labs' dialogue-focused TTS) served via devnen/Dia-TTS-Server.
#
# Why this stack exists alongside the other TTS:
# * DIALOGUE scenes with nonverbal cues — Dia generates multi-speaker
# turn-taking in a single pass with inline [S1]/[S2] speaker tags
# and nonverbals like (laughs), (coughs), (sighs). Purpose-built for
# the character-dialogue case skaldsong's storytelling hits, which
# the single-speaker engines (Fish/Index/Chatterbox) don't own.
# * Dia2 (released 2025-11-19) adds realtime streaming + a 2B
# high-quality checkpoint.
# * Apache-2.0 model weights; MIT wrapper; OpenAI-compat
# /v1/audio/speech so skaldsong can target it by base-URL.
# * ~7 GB VRAM at BF16 SafeTensors.
# Dialogue scenes none of the other bench TTS own cleanly: multi-speaker
# turn-taking in one pass with inline [S1]/[S2] tags + nonverbals
# (laughs)/(coughs)/(sighs). OpenAI-compat POST /v1/audio/speech.
#
# Image is built locally from the upstream wrapper via docker buildx
# git-context (no source vendored on the host) — same pattern as
# chatterbox/fish-s2.
# This stack runs TWO fixed-model instances from the dia2-capable image
# (local/dia:v2 — built in two stages: the upstream devnen wrapper image
# local/dia:v1, then dia2-image/Dockerfile layers in the dia2 package +
# its missing runtime deps; see README). The wrapper serves whatever model
# is loaded and IGNORES per-request model selection, so the only way to
# offer multiple Dia2 models to asset-engine as real choices is one fixed
# instance per model — which is exactly this:
# * dia2-2b — Dia2 2B, highest quality (:8200, the primary dia port)
# * dia2-1b — Dia2 1B, streaming/faster (:8202)
# Each pins ONE model via its mounted config.yaml. Legacy Dia 1.6B retired
# (operator decision 2026-05-31).
#
# All tunables live in .env — edit that, not this file.
services:
dia:
dia2-2b:
image: local/dia:${DIA_TAG}
build:
# Single Dockerfile at repo root; GPU via NVIDIA Container Toolkit.
context: https://github.com/devnen/Dia-TTS-Server.git#${DIA_SHA}
dockerfile: Dockerfile
container_name: dia
container_name: dia2-2b
restart: unless-stopped
runtime: nvidia
ports:
- "${DIA_BIND:-0.0.0.0}:${DIA_PORT}:8003"
- "${DIA_BIND:-0.0.0.0}:${DIA2_2B_PORT}:8003"
environment:
- NVIDIA_VISIBLE_DEVICES=${DIA_GPU_DEVICES:-0}
- NVIDIA_VISIBLE_DEVICES=${DIA2_2B_GPU:-0}
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
# Speeds the first-boot HF download of the checkpoint.
- HF_HUB_ENABLE_HF_TRANSFER=1
- HF_HOME=/app/hf_cache
volumes:
- ${DIA_REFERENCE_DIR}:/app/reference_audio
- ${DIA_CACHE_DIR}:/app/hf_cache
# Model selection lives in the wrapper's config.yaml (model.repo_id):
# mount a host config to pin a default of Dia2-1B / Dia2-2B instead
# of the in-image default (Dia 1.6B). Otherwise switch live in the
# Web UI (selection may not survive a container recreate).
# - ${DIA_CONFIG}:/app/config.yaml
# Pins model.repo_id=nari-labs/Dia2-2B (highest quality).
- ${DIA2_2B_CONFIG}:/app/config.yaml
healthcheck:
# devnen's Dia server exposes GET /health (liveness) plus
# /api/model-status (download/load progress) and /api/model-info.
# /health is the simple liveness probe; start_period covers the
# first-boot model pull. python urllib (image has no curl), bound
# to 127.0.0.1 (uvicorn is IPv4-only).
test: ["CMD-SHELL", "python3 -c \"import urllib.request,sys; urllib.request.urlopen('http://127.0.0.1:8003/health', timeout=5); sys.exit(0)\""]
interval: 30s
timeout: 10s
retries: 3
# First boot pulls the checkpoint (~6-10 GB) — generous deadline.
# First boot pulls the Dia2-2B checkpoint — generous deadline.
start_period: 600s
labels:
- homepage.group=AI Systems
- homepage.name=Dia / Dia2
- homepage.name=Dia2 2B (HQ)
- homepage.icon=mdi-account-voice
- homepage.description=Dialogue TTS — multi-speaker turn-taking + nonverbals (irv-ml1)
- homepage.href=http://10.100.79.3:${DIA_PORT}
- homepage.description=Dialogue TTS — Dia2 2B, highest quality (irv-ml1)
- homepage.href=http://10.100.79.3:${DIA2_2B_PORT}
dia2-1b:
image: local/dia:${DIA_TAG}
container_name: dia2-1b
restart: unless-stopped
runtime: nvidia
ports:
- "${DIA_BIND:-0.0.0.0}:${DIA2_1B_PORT}:8003"
environment:
- NVIDIA_VISIBLE_DEVICES=${DIA2_1B_GPU:-0}
- NVIDIA_DRIVER_CAPABILITIES=compute,utility
- HF_HUB_ENABLE_HF_TRANSFER=1
- HF_HOME=/app/hf_cache
volumes:
- ${DIA_REFERENCE_DIR}:/app/reference_audio
- ${DIA_CACHE_DIR}:/app/hf_cache
# Pins model.repo_id=nari-labs/Dia2-1B (streaming, lower latency).
- ${DIA2_1B_CONFIG}:/app/config.yaml
healthcheck:
test: ["CMD-SHELL", "python3 -c \"import urllib.request,sys; urllib.request.urlopen('http://127.0.0.1:8003/health', timeout=5); sys.exit(0)\""]
interval: 30s
timeout: 10s
retries: 3
start_period: 600s
labels:
- homepage.group=AI Systems
- homepage.name=Dia2 1B (Streaming)
- homepage.icon=mdi-account-voice
- homepage.description=Dialogue TTS — Dia2 1B, streaming/faster (irv-ml1)
- homepage.href=http://10.100.79.3:${DIA2_1B_PORT}