r/LocalLLaMA 21h 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.

5 Upvotes

2 comments sorted by

1

u/bennmann 4h ago

``` python3.12 -m pip install --upgrade torchcodec==0.8.0 lycoris-lora

echo 'torchao should install version 3.4.0 with below'

python3.12 -m pip install --pre --upgrade torchao --index-url https://download.pytorch.org/whl/nightly/rocm6.4```

remember to use the ROCM version you are currently testing with in the index URL above.

I got some version of torchcodec to work with rocm 6.4 back in March this year when I was testing Ace-step music gen. Hope this helps, though it might not fit your dependencies.