PaddleSpeech docker develop-gpu-cuda10.2-cudnn7-latest 缺失 libsndfile1-dev 和 環境參數CUDA_VISIBLE_DEVICES
Paddle可以說是各種坑,但支持國產,含淚試用了百度飛漿的Speech。
https://github.com/PaddlePaddle/PaddleSpeech/issues/3158
1. 坑點
Docker develop-gpu-cuda10.2-cudnn7-latest 缺失:
1. libsndfile1-dev
2. CUDA_VISIBLE_DEVICES
2. 安裝教程
也沒什麼安裝教程。下載docker鏡像和項目源碼。
docker pull paddlecloud/paddlespeech:develop-gpu-cuda10.2-cudnn7-latest
docker鏡像
git clone https://github.com/PaddlePaddle/PaddleSpeech
項目源碼
3. 測試顯示卡
nvidia-docker run --runtime=nvidia -it -v ~/PycharmProjects/PaddleSpeech:/home paddlecloud/paddlespeech:develop-gpu-cuda10.2-cudnn7-latest /bin/bash
進入Docker鏡像
nvidia-smi
nvcc -V
./test_cuda
4. Bug
cd demos/style_fs2 && ./run.sh
出現error
4.1 缺失 libsndfile1-dev
Traceback (most recent call last): File "style_syn.py", line 22, in <module> import soundfile as sf File "/usr/local/python3.7.0/lib/python3.7/site-packages/soundfile.py", line 192, in <module> _snd = _ffi.dlopen(_explicit_libname) OSError: cannot load library 'libsndfile.so': libsndfile.so: cannot open shared object file: No such file or directory
我猜測,這是CUDA10.2官方docker的bug,里面缺少了libsndfile1-dev。
apt install libsndfile1-dev
成功解決
4.2 缺失 環境參數CUDA_VISIBLE_DEVICES
Traceback (most recent call last): File "style_syn.py", line 228, in <module> main() File "style_syn.py", line 209, in main paddle.set_device("gpu") File "/usr/local/python3.7.0/lib/python3.7/site-packages/paddle/device/__init__.py", line 313, in set_device place = _convert_to_place(device) File "/usr/local/python3.7.0/lib/python3.7/site-packages/paddle/device/__init__.py", line 204, in _convert_to_place place = core.CUDAPlace(ParallelEnv().dev_id) OSError: (External) CUDA error(100), no CUDA-capable device is detected. [Hint: 'cudaErrorNoDevice'. This indicates that no CUDA-capable devices were detected by the installed CUDA driver. ] (at /paddle/paddle/phi/backends/gpu/cuda/cuda_info.cc:66)
因缺失 環境參數CUDA_VISIBLE_DEVICES,導致PaddleSpeech失敗獲取GPU。
import os os.environ["CUDA_VISIBLE_DEVICES"] = "0"
當設置CUDA_VISIBLE_DEVICES=0後,成功解決。
5.0 成功