perf(voice): run STT+TTS on the GPU by default with CPU fallback
Both voice backends defaulted to CPU. Fix the "CUDA unavailable" gaps so everything that benefits from the RTX 5050 uses it: - MeloTTS venv had CPU-only torch (2.12.0+cpu) -> installed Blackwell-capable torch/torchaudio 2.11.0+cu128 (sm_120 verified with a real GPU matmul). - faster-whisper CUDA loaded but transcribe() died with "libcublas.so.12 not found": installed nvidia-cublas-cu12 + nvidia-cudnn-cu12 into the whisper venv and inject those nvidia/*/lib dirs into the worker's LD_LIBRARY_PATH at spawn (the loader only honours it at exec). - WSAI_WHISPER_DEVICE / WSAI_MELO_DEVICE now default to "auto": pick CUDA when present, else CPU, and each worker falls back to CPU if a CUDA load fails so the voice loop never dies on a GPU-less host. Verified end-to-end through the real backend classes: both workers report "ready on cuda"; steady-state STT ~170ms (was ~1350ms CPU), TTS ~4s first call vs ~23s CPU. All 12 tests pass. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -9,7 +9,8 @@ integration later swaps the sink for "play this wav into the call".
|
||||
Env:
|
||||
WSAI_MELO_PYTHON interpreter with melo installed
|
||||
(default: /home/claude/jarvis-tts/melo311/bin/python)
|
||||
WSAI_MELO_DEVICE cpu | cuda | auto (default cpu; cuda needs GPU approval)
|
||||
WSAI_MELO_DEVICE cpu | cuda | auto (default auto: GPU if torch sees one,
|
||||
else CPU; the worker falls back to CPU if CUDA fails)
|
||||
WSAI_TTS_OUT_DIR where wavs are written (default ~/.cache/wsai/tts)
|
||||
WSAI_TTS_SPEED synthesis speed multiplier (default 1.3)
|
||||
"""
|
||||
@@ -50,7 +51,7 @@ class MeloTTS:
|
||||
sink: Sink | None = None,
|
||||
) -> None:
|
||||
self.python = python or os.environ.get("WSAI_MELO_PYTHON", _DEFAULT_PYTHON)
|
||||
self.device = device or os.environ.get("WSAI_MELO_DEVICE", "cpu")
|
||||
self.device = device or os.environ.get("WSAI_MELO_DEVICE", "auto")
|
||||
self.out_dir = Path(out_dir or os.environ.get("WSAI_TTS_OUT_DIR")
|
||||
or (Path.home() / ".cache/wsai/tts"))
|
||||
self.speed = float(speed if speed is not None
|
||||
|
||||
Reference in New Issue
Block a user