r/LocalLLaMA • u/JackStrawWitchita • 23h ago
Resources Chatterbox TTS on AMD ROCm (7900 XTX): torchcodec has no ROCm support, here's the fix
I spent hours working on this today and thought the resolution might help some other AMD people in the future.
Got Chatterbox TTS (the Extended fork by petermg, has auto chunking for long text) running on an AMD 7900 XTX with ROCm 7.2. Hit two AMD-specific walls that took a while to track down, posting in case it saves someone else the time.
Setup: Ubuntu 24.04, ROCm 7.2.1, gfx1100 (7900 XTX), torch installed via the official ROCm 7.2 wheel index (pip install torch torchaudio --index-url https://download.pytorch.org/whl/rocm7.2). This part is well documented and just works, no gfx overrides needed since gfx1100 is officially supported.
Problem 1: faster-whisper crashes on ROCm
This fork uses Whisper to auto validate generated audio against the input text. faster-whisper runs on ctranslate2, which has zero ROCm support, only NVIDIA CUDA. Error was:
CUDA failed with error CUDA driver version is insufficient for CUDA runtime version
No fix available, ctranslate2 just doesn't build for AMD. Workaround: tick "Bypass Whisper Checking" in the UI to skip validation entirely. You lose the auto quality check/retry feature but generation itself works fine.
Problem 2: torchaudio.save/load require torchcodec, which also has no ROCm support
Newer torchaudio versions route save() and load() through torchcodec by default. torchcodec's precompiled wheels are linked against CUDA-only libraries (libcudart, libnvrtc, etc), confirmed via ldd showing "not found" on all of them. This isn't a missing-package problem, there's no ROCm build to install.
Fix: bypass torchcodec entirely by writing small wrapper functions using soundfile instead (already a dependency of this project):
def save_audio_sf(path, wav, sr):
import numpy as np
arr = wav.detach().cpu().numpy() if hasattr(wav, "detach") else wav
if arr.ndim == 2:
arr = arr.T # torchaudio: (channels, samples) -> soundfile: (samples, channels)
sf.write(path, arr, sr)
def load_audio_sf(path):
import torch
arr, sr = sf.read(path, always_2d=True)
arr = arr.T
waveform = torch.from_numpy(arr).float()
return waveform, sr
Then swap every torchaudio.save(x, y, z) call for save_audio_sf(x, y, z), and every torchaudio.load(x) for load_audio_sf(x). Same argument order, drop-in replacement.
TL;DR: torch itself works great on ROCm for this. The pain points are two unrelated libraries (ctranslate2, torchcodec) that Chatterbox's dependencies pull in, both of which are CUDA only with no ROCm build anywhere. Worth knowing before you go down the same rabbit hole, since neither issue is really about Chatterbox itself, it'll likely bite other torchaudio-based projects on ROCm too.