尝试运行 Tortoise-TTS 程序:“OSError:无法加载库‘libsndfile.dll’:错误 0x7e”

问题描述 投票:0回答:2

我正在尝试运行这个文本到语音程序

我一字不差地按照说明操作,但是当我去运行第一行代码时(如下)

python tortoise/do_tts.py --text "I'm going to speak this" --voice random --preset fast

我得到以下错误代码:

C:\Users\chase\anaconda3\lib\site-packages\torchaudio\_internal\module_utils.py:99: UserWarning: Failed to import soundfile. 'soundfile' backend is not available.
  warnings.warn("Failed to import soundfile. 'soundfile' backend is not available.")
C:\Users\chase\anaconda3\lib\site-packages\paramiko\transport.py:219: CryptographyDeprecationWarning: Blowfish has been deprecated
  "class": algorithms.Blowfish,
Traceback (most recent call last):
  File "C:\Users\chase\anaconda3\lib\site-packages\soundfile.py", line 152, in <module>
    _snd = _ffi.dlopen(_libname)
OSError: cannot load library 'C:\Users\chase\anaconda3\Library\bin\sndfile.dll': error 0x7e

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\chase\anaconda3\lib\site-packages\soundfile.py", line 178, in <module>
    _snd = _ffi.dlopen(_os.path.join(_path, '_soundfile_data', _packaged_libname))
OSError: cannot load library 'C:\Users\chase\anaconda3\lib\site-packages\_soundfile_data\libsndfile_64bit.dll': error 0x7e

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\chase\tortoise-tts\tortoise\do_tts.py", line 7, in <module>
    from api import TextToSpeech, MODELS_DIR
  File "C:\Users\chase\tortoise-tts\tortoise\api.py", line 22, in <module>
    from tortoise.utils.audio import wav_to_univnet_mel, denormalize_tacotron_mel
  File "C:\Users\chase\anaconda3\lib\site-packages\tortoise-2.4.2-py3.9.egg\tortoise\utils\audio.py", line 4, in <module>
    import librosa
  File "C:\Users\chase\anaconda3\lib\site-packages\librosa-0.9.2-py3.9.egg\librosa\__init__.py", line 209, in <module>
    from . import core
  File "C:\Users\chase\anaconda3\lib\site-packages\librosa-0.9.2-py3.9.egg\librosa\core\__init__.py", line 6, in <module>
    from .audio import *  # pylint: disable=wildcard-import
  File "C:\Users\chase\anaconda3\lib\site-packages\librosa-0.9.2-py3.9.egg\librosa\core\audio.py", line 8, in <module>
    import soundfile as sf
  File "C:\Users\chase\anaconda3\lib\site-packages\soundfile.py", line 189, in <module>
    _snd = _ffi.dlopen(_libname)
OSError: cannot load library 'libsndfile.dll': error 0x7e

我预计它会运行

python github pip conda text-to-speech
2个回答
0
投票

在 linux 上试试,它对我来说很好。


0
投票

尝试创建一个新的conda环境。来自https://github.com/bastibe/python-soundfile/issues/373:

只是为了添加额外的信息——我在我的基础 conda 环境中尝试使用声音文件时得到了上面的信息。当我创建一个新环境时,它似乎工作正常。


或者你可以使用Ubuntu如下(基于https://github.com/neonbjb/tortoise-tts/blob/main/README.md + https://github.com/neonbjb/tortoise-tts/问题/390):

conda create -n ttspy38 python=3.8
conda activate ttspy38

conda install pytorch torchvision torchaudio pytorch-cuda=11.8 -c pytorch -c nvidia
git clone https://github.com/neonbjb/tortoise-tts.git
cd tortoise-tts
python -m pip install -r ./requirements.txt
pip uninstall pydantic
pip install pydantic==1.9.1
python setup.py install
python tortoise/do_tts.py --text "I'm going to speak this" --voice random --preset fast

我用 Ubuntu 20.04.5 + CUDA 12 + Nvidia A100 80GB GPU 测试了它。

© www.soinside.com 2019 - 2024. All rights reserved.