背景
在使用modelscope的speech_eres2net_sv_zh-cn_16k-common模型时,执行代码遇到的报错问题
Traceback (most recent call last):
File "/opt/module/python/lib/python3.10/site-packages/torchaudio/_extension/utils.py", line 207, in wrapped
_init_sox()
File "/opt/module/python/lib/python3.10/site-packages/torchaudio/_extension/utils.py", line 70, in _init_sox
_load_lib("libtorchaudio_sox")
File "/opt/module/python/lib/python3.10/site-packages/torchaudio/_extension/utils.py", line 64, in _load_lib
torch.ops.load_library(path)
File "/opt/module/python/lib/python3.10/site-packages/torch/_ops.py", line 852, in load_library
ctypes.CDLL(path)
File "/opt/module/python/lib/python3.10/ctypes/__init__.py", line 374, in __init__
self._handle = _dlopen(self._name, mode)
OSError: libsox.so: cannot open shared object file: No such file or directory
Traceback (most recent call last):
File "/opt/module/ModelScope/speech_campplus.py", line 11, in <module>
result = sv_pipline([speaker1_a_wav, speaker1_b_wav])
File "/opt/module/python/lib/python3.10/site-packages/modelscope/pipelines/audio/speaker_verification_eres2net_pipeline.py", line 64, in __call__
wavs = self.preprocess(in_audios)
File "/opt/module/python/lib/python3.10/site-packages/modelscope/pipelines/audio/speaker_verification_eres2net_pipeline.py", line 121, in preprocess
data, fs = torchaudio.sox_effects.apply_effects_tensor(
File "/opt/module/python/lib/python3.10/site-packages/torchaudio/_extension/utils.py", line 209, in wrapped
raise RuntimeError(
RuntimeError: apply_effects_tensor requires sox extension which is not available. Please refer to the stacktrace above for how to resolve this.
首先尝试解决apply_effects_tensor requires sox extension which is not available的问题
centos系统执行
yum install sox
Ubuntu系统执行
sudo apt-get install sox
再解决 libsox.so: cannot open shared object file: No such file or directory的问题
主要问题是 libsox.so这个文件找不到
libsox.so文件是SoX音频处理库的共享库文件。
sox是一个用于处理音频文件的强大命令行工具和库
它支持多种音频格式,如MP3,WAV,OGG等,并提供了许多音频处理功能,如混音,剪辑,压缩,滤波等
所以说在处理音频的一些模型中可能会依赖此文件
先尝试在系统中能否找到改文件
find / -name 'libsox.so*'

这是在centos8系统下找到的
进入所在文件夹
cd /usr/lib64
将 libsox.so.2 复制一份并重命名为 libsox.so
cp libsox.so.2 libsox.so


749

被折叠的 条评论
为什么被折叠?



