CosyVoice icon indicating copy to clipboard operation
CosyVoice copied to clipboard

fix: read wav via soundfile to avoid torchcodec dependency

Open jasagiri opened this issue 6 months ago • 0 comments

Summary

load_wav calls torchaudio.load, which since torchaudio 2.8 routes through torchcodec — an optional dependency frequently not installed. On such setups load_wav fails with an ImportError before any inference runs.

This reads the file directly with soundfile and falls back to torchaudio only if that fails.

Test plan

  • [ ] load_wav('asset/zero_shot_prompt.wav', 24000) returns a tensor on a torchaudio build without torchcodec

jasagiri avatar May 18 '26 05:05 jasagiri