Skip to content

fix: add torchaudio 2.9 compatibility for list_audio_backends removal#1148

Open
Mr-Neutr0n wants to merge 1 commit intofishaudio:mainfrom
Mr-Neutr0n:fix/torchaudio-29-compatibility
Open

fix: add torchaudio 2.9 compatibility for list_audio_backends removal#1148
Mr-Neutr0n wants to merge 1 commit intofishaudio:mainfrom
Mr-Neutr0n:fix/torchaudio-29-compatibility

Conversation

@Mr-Neutr0n
Copy link

Summary

Fix crash on startup with torchaudio 2.9+ due to removed list_audio_backends() function.

Problem

torchaudio.list_audio_backends() was deprecated in torchaudio 2.8 and removed in 2.9 (released Oct 2025). Since the project's pyproject.toml has unpinned torchaudio dependency, users installing with CUDA 12.8 extras get torchaudio 2.9+, which causes:

AttributeError: module 'torchaudio' has no attribute 'list_audio_backends'

Affected files:

  • tools/vqgan/extract_vq.py
  • fish_speech/inference_engine/reference_loader.py

Solution

Added try/except to handle both old and new torchaudio versions:

  • For torchaudio < 2.9: Uses list_audio_backends() as before
  • For torchaudio 2.9+: Attempts to detect ffmpeg availability by importing the ffmpeg-related module, falling back to soundfile if unavailable

This maintains backward compatibility while supporting the latest torchaudio.

Fixes #1118

torchaudio.list_audio_backends() was deprecated in 2.8 and removed in 2.9.
Added try/except to handle both old and new torchaudio versions.

For torchaudio 2.9+, attempts to detect ffmpeg availability by trying to
import the ffmpeg-related module, falling back to soundfile if unavailable.

Fixes fishaudio#1118
@Mr-Neutr0n
Copy link
Author

Friendly bump! Let me know if there's anything I should update or improve to help move this forward.

@github-actions
Copy link
Contributor

This PR is stale because it has been open for 30 days with no activity.

@github-actions github-actions bot added the stale label Mar 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Crash on startup: AttributeError: torchaudio.list_audio_backends (TorchAudio 2.9 removal)

1 participant