CosyVoice
CosyVoice copied to clipboard
fix: read wav via soundfile to avoid torchcodec dependency
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