VoxCPM icon indicating copy to clipboard operation
VoxCPM copied to clipboard

传参考音频会报错 Error generating audio: Could not load libtorchcodec.

Open byebyebruce opened this issue 2 months ago • 6 comments

传参考音频会报错

input: 你好,这是一个测试文本。
voice: example
prompt_wav_path: ./voices/example.wav
prompt_text: reference transcript
Error generating audio: Could not load libtorchcodec. Likely causes:
          1. FFmpeg is not properly installed in your environment. We support
             versions 4, 5, 6, 7, and 8. On Windows, ensure you've installed
             the "full-shared" version which ships DLLs.
          2. The PyTorch version (2.9.1+cu128) is not compatible with
             this version of TorchCodec. Refer to the version compatibility
             table:
             https://github.com/pytorch/torchcodec?tab=readme-ov-file#installing-torchcodec.
          3. Another runtime dependency; see exceptions below.
        The following exceptions were raised as we tried to load libtorchcodec:
        
[start of libtorchcodec loading traceback]
FFmpeg version 8: Could not load this library: /home/bruce/proj/VoxCPM/.venv/lib/python3.10/site-packages/torchcodec/libtorchcodec_core8.so
FFmpeg version 7: Could not load this library: /home/bruce/proj/VoxCPM/.venv/lib/python3.10/site-packages/torchcodec/libtorchcodec_core7.so
FFmpeg version 6: Could not load this library: /home/bruce/proj/VoxCPM/.venv/lib/python3.10/site-packages/torchcodec/libtorchcodec_core6.so
FFmpeg version 5: Could not load this library: /home/bruce/proj/VoxCPM/.venv/lib/python3.10/site-packages/torchcodec/libtorchcodec_core5.so
FFmpeg version 4: Could not load this library: /home/bruce/proj/VoxCPM/.venv/lib/python3.10/site-packages/torchcodec/libtorchcodec_core4.so
[end of libtorchcodec loading traceback].

torchcodec 和ffmpeg都有安装

uv pip show torchcodec    
Name: torchcodec
Version: 0.9.1
Location: /home/bruce/proj/VoxCPM/.venv/lib/python3.10/site-packages
Requires:
Required-by:
(voxcpm) (base) 
ffmpeg -v       
ffmpeg version 4.2.7-0ubuntu0.1 Copyright (c) 2000-2022 the FFmpeg developers
  built with gcc 9 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
  configuration: --prefix=/usr --extra-version=0ubuntu0

byebyebruce avatar Dec 12 '25 08:12 byebyebruce

设置一下路径:export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH

Asstar-X avatar Dec 12 '25 08:12 Asstar-X

安装torch相关组件最好使用pytorch官方的pypi来下载

Ayin1412 avatar Dec 12 '25 13:12 Ayin1412

可以看看ffmpeg 有没有安装,brew install ffmpeg, 以及 pip install torchcodec

liuxin99 avatar Dec 12 '25 14:12 liuxin99

我也是这样,然后看了下2.8 2.9的torchaudio加载音频时,初始化torchaudio会使用torchcodec,然后我把torch和torchaudio降级了,这时候load模型又出问题。

kmmang avatar Dec 13 '25 03:12 kmmang

我也是这样,然后看了下2.8 2.9的torchaudio加载音频时,初始化torchaudio会使用torchcodec,然后我把torch和torchaudio降级了,这时候load模型又出问题。

load 会出啥问题呢

liuxin99 avatar Dec 13 '25 03:12 liuxin99

我也是这样,然后看了下2.8 2.9的torchaudio加载音频时,初始化torchaudio会使用torchcodec,然后我把torch和torchaudio降级了,这时候load模型又出问题。

load 会出啥问题呢

就是关于什么torch._dynamo的,但是2.9的torch就没这个问题

kmmang avatar Dec 13 '25 03:12 kmmang