1 创建虚拟环境
conda create -n paddletts python==3.8
conda activate paddletts
2 安装paddlespeech
查看cuda版本
(paddletts) G:\oddmeta>nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2021 NVIDIA Corporation
Built on Mon_May__3_19:41:42_Pacific_Daylight_Time_2021
Cuda compilation tools, release 11.3, V11.3.109
Build cuda_11.3.r11.3/compiler.29920130_0
得到本地的cuda版本为11.3
到pp官网查看windows下与cuda11.3版本匹配的安装命令https://www.paddlepaddle.org.cn/
python -m pip install paddlepaddle-gpu==2.5.1.post112 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html
or
python -m pip install paddlepaddle-gpu==2.5.0 -f https://www.paddlepaddle.org.cn/whl/windows/mkl/avx/stable.html
如果没有GPU,或者电脑太老,GPU太老,跑不起来的话,切CPU版本
pip install paddlepaddle==2.5.1 -i https://pypi.tuna.tsinghua.edu.cn/simple
我电脑上安装2.5.1后,运行paddlespeech报错,ModuleNotFoundError: No module named ‘paddle‘,移除安装,改用2.4.1后,可正常运行。
pip install paddlepaddle==2.4.1 -i https://mirror.baidu.com/pypi/simple
用pip 安装paddlespeech
pip install pytest-runner
pip install paddlespeech
省流:
默认安装的protobuf版本为protobuf 3.20.2,卸载了安装3.19
pip uninstall protobuf
pip install protobuf==3.19
默认安装的paddlenlp版本为paddlenlp 2.6.0rc0 依赖 protobuf==3.20.2
pip install paddlenlp==2.5
默认安装的NumPy的版本为NumPy 1.24.4,改成1.23.5
pip uninstall numpy
pip install numpy==1.23.5 -i https://pypi.tuna.tsinghua.edu.cn/simple
测试
paddlespeech tts --input "你好,欢迎光临落鹤生的个人知识库,来随便问问吧!" --output output.wav
报错1:module ‘numpy’ has no attribute ‘complex’.
(paddletts) G:\oddmeta>paddlespeech tts --input "你好,欢迎光临落鹤生的个人知识库,来随便问问吧!" --output output.wav
Traceback (most recent call last):
File "C:\Users\Administrator\.conda\envs\paddletts\lib\runpy.py", line 192, in _run_module_as_main
return _run_code(code, main_globals, None,
File "C:\Users\Administrator\.conda\envs\paddletts\lib\runpy.py", line 85, in _run_code
exec(code, run_globals)
File "C:\Users\Administrator\.conda\envs\paddletts\Scripts\paddlespeech.exe\__main__.py", line 7, in <module>
File "C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\paddlespeech\cli\entry.py", line 40, in _execute
exec("from {} import {}".format(module, cls))
File "<string>", line 1, in <module>
File "C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\paddlespeech\cli\tts\__init__.py", line 14, in <module>
from .infer import TTSExecutor
File "C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\paddlespeech\cli\tts\infer.py", line 33, in <module>
from paddlespeech.t2s.exps.syn_utils import get_am_inference
File "C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\paddlespeech\t2s\__init__.py", line 19, in <module>
from . import models
File "C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\paddlespeech\t2s\models\__init__.py", line 14, in <module>
from .ernie_sat import *
File "C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\paddlespeech\t2s\models\ernie_sat\__init__.py", line 14, in <module>
from .ernie_sat import *
File "C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\paddlespeech\t2s\models\ernie_sat\ernie_sat.py", line 21, in <module>
from paddlespeech.t2s.modules.activation import get_activation
File "C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\paddlespeech\t2s\modules\__init__.py", line 16, in <module>
from .losses import *
File "C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\paddlespeech\t2s\modules\losses.py", line 16, in <module>
import librosa
File "C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\librosa\__init__.py", line 211, in <module>
from . import core
File "C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\librosa\core\__init__.py", line 9, in <module>
from .constantq import * # pylint: disable=wildcard-import
File "C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\librosa\core\constantq.py", line 1059, in <module>
dtype=np.complex,
File "C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\numpy\__init__.py", line 305, in __getattr__
raise AttributeError(__former_attrs__[attr])
AttributeError: module 'numpy' has no attribute 'complex'.
`np.complex` was a deprecated alias for the builtin `complex`. To avoid this error in existing code, use `complex` by itself. Doing this will not modify any behavior and is safe. If you specifically wanted the numpy scalar type, use `np.complex128` here.
The aliases was originally deprecated in NumPy 1.20; for more details and guidance see the original release note at:
https://numpy.org/devdocs/release/1.20.0-notes.html#deprecations
解决方案
pip uninstall numpy
pip install numpy==1.23.5 -i https://pypi.tuna.tsinghua.edu.cn/simple
paddlespeech tts --input "你好,欢迎光临落鹤生的个人知识库,来随便问问吧!" --output output.wav
报错2:The GPU architecture is not compatible with Paddle installation with arch: 70 75 80 86
(paddletts) G:\oddmeta>paddlespeech tts --input "你好,欢迎光临落鹤生的个人知识库,来随便问问吧!" --output output.wav
C:\Users\Administrator\.conda\envs\paddletts\lib\site-packages\_distutils_hack\__init__.py:33: UserWarning: Setuptools is replacing distutils.
warnings.warn("Setuptools is replacing distutils.")
100%|████████████████████████████████████████████████████████████████████████| 477172/477172 [00:55<00:00, 8532.29it/s]
100%|████████████████████████████████████████████████████████████████████████| 893777/893777 [01:35<00:00, 9310.48it/s]
100%|████████████████████████████████████████████████████████████████████████| 575056/575056 [01:02<00:00, 9129.47it/s]
100%|███████████████████████████████████████████████████████████████████████████████| 107k/107k [00:00<00:00, 1.49MB/s]
W0814 10:01:06.194772 492468 gpu_resources.cc:96] The GPU architecture in your current machine is Maxwell, which is not compatible with Paddle installation with arch: 70 75 80 86 , it is recommended to install the corresponding wheel package according to the installation information on the official Paddle website.
W0814 10:01:06.199754 492468 gpu_resources.cc:119] Please NOTE: device: 0, GPU Compute Capability: 5.0, Driver API Version: 12.0, Runtime API Version: 11.2
W0814 10:01:06.222723 492468 dynamic_loader.cc:274] Note: [Recommend] copy cudnn into CUDA installation directory.
For instance, download cudnn-10.0-windows10-x64-v7.6.5.32.zip from NVIDIA's official website,
then, unzip it and copy it into C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
You should do this according to your CUDA installation directory and CUDNN version.
RuntimeError: (PreconditionNotMet) The third-party dynamic library (cudnn64_8.dll) that Paddle depends on is not configured correctly. (error code is 126)
Suggestions:
1. Check if the third-party dynamic library (e.g. CUDA, CUDNN) is installed correctly and its version is matched with paddlepaddle you installed.
2. Configure third-party dynamic library environment variables as follows:
- Linux: set LD_LIBRARY_PATH by `export LD_LIBRARY_PATH=...`
- Windows: set PATH by `set PATH=XXX; (at ..\paddle\phi\backends\dynload\dynamic_loader.cc:301)
解决方案
笔记本电脑太旧,上面GPU太老了,不支持,而且下载cudnn大半天下载不下来,因此切回到CPU版本。
pip install paddlepaddle==2.4.1 -i https://mirror.baidu.com/pypi/simple