我从 https://github.com/NVlabs/stylegan 下载了stylegan的代码,并希望用我的数据集进行训练。我在Ubuntu机器上工作(Ubuntu 18.04.3 LTS),当我运行
python train.py
时,出现了错误,显示如下:
2020-01-26 23:30:27.115726: E tensorflow/stream_executor/cuda/cuda_dnn.cc:329] 无法创建cudnn句柄: CUDNN_STATUS_NOT_INITIALIZED 2020-01-26 23:30:27.115811: E tensorflow/stream_executor/cuda/cuda_dnn.cc:337] 可能的驱动程序版本不足: 430.50.0
以下是我cuda、cudnn和pip list的输出结果:
$ nvcc --versionnvcc: NVIDIA (R) Cuda编译器驱动版权所有 (c) 2005-2018 NVIDIA Corporation构建于Sat_Aug_25_21:08:01_CDT_2018Cuda编译工具,发布版本10.0,V10.0.130$nvidia-smi+-----------------------------------------------------------------------------+| NVIDIA-SMI 430.50 驱动程序版本: 430.50 CUDA版本: 10.1 ||-------------------------------+----------------------+----------------------+| GPU 名称 持久化模式| 总线-ID 显示.A | 易失性未校正ECC || 风扇 温度 性能 电源:使用/容量| 内存使用情况 | GPU使用率 计算M. ||===============================+======================+======================|| 0 GeForce RTX 2060 关闭 | 00000000:01:00.0 开 | N/A || 42% 37C P8 14W / 170W | 529MiB / 5931MiB | 2% 默认 |+-------------------------------+----------------------+----------------------++-----------------------------------------------------------------------------+| 进程: GPU内存 || GPU PID 类型 进程名称 使用量 ||=============================================================================|| 0 1100 G /usr/lib/xorg/Xorg 245MiB || 0 1578 G /usr/bin/gnome-shell 149MiB || 0 2179 G ...quest-channel-token=1359353350696709871 132MiB |+-----------------------------------------------------------------------------+$dpkg -l | grep -i cudnnii libcudnn7 7.6.5.32-1+cuda10.2 amd64 cuDNN运行时库ii libcudnn7-dev 7.6.5.32-1+cuda10.2 amd64 cuDNN开发库和头文件$pip listabsl-py (0.9.0)astor (0.8.1)bleach (1.5.0)certifi (2019.11.28)chardet (3.0.4)gast (0.3.3)google-pasta (0.1.8)grpcio (1.26.0)h5py (2.10.0)html5lib (0.9999999)idna (2.8)Keras-Applications (1.0.8)Keras-Preprocessing (1.1.0)Markdown (3.1.1)mock (3.0.5)numpy (1.18.1)opencv-python (4.1.0.25)Pillow (6.1.0)pip (9.0.1)pkg-resources (0.0.0)protobuf (3.11.2)requests (2.22.0)scipy (1.2.0)setuptools (45.1.0)six (1.14.0)tensorboard (1.14.0)tensorflow-estimator (1.14.0)tensorflow-gpu (1.14.0)termcolor (1.1.0)tqdm (4.32.2)urllib3 (1.25.7)Werkzeug (0.16.0)wheel (0.33.6)wrapt (1.11.2)absl-py (0.9.0)astor (0.8.1)bleach (1.5.0)certifi (2019.11.28)chardet (3.0.4)gast (0.3.3)google-pasta (0.1.8)grpcio (1.26.0)h5py (2.10.0)html5lib (0.9999999)idna (2.8)Keras-Applications (1.0.8)Keras-Preprocessing (1.1.0)Markdown (3.1.1)mock (3.0.5)numpy (1.18.1)opencv-python (4.1.0.25)Pillow (6.1.0)pip (9.0.1)pkg-resources (0.0.0)protobuf (3.11.2)requests (2.22.0)scipy (1.2.0)setuptools (45.1.0)six (1.14.0)tensorboard (1.14.0)tensorflow-estimator (1.14.0)tensorflow-gpu (1.14.0)termcolor (1.1.0)tqdm (4.32.2)urllib3 (1.25.7)Werkzeug (0.16.0)wheel (0.33.6)wrapt (1.11.2)
有没有人知道这些工具的特定版本可以让我运行stylegan?
回答:
在这里提供解决方案(回答部分),尽管它已经在评论部分出现,但为了社区的利益,这里再次提供。
首先需要删除所有cuDNN文件
rm -f /usr/include/cudnn.h rm -f /usr/lib/x86_64-linux-gnu/*libcudnn* rm -f /usr/local/cuda-/lib64/*libcudnn
现在从 这里 提取新的cuDNN
为了下载cuDNN,请确保您已注册 NVIDIA开发者计划。
- 访问: NVIDIA cuDNN主页。
- 点击下载。
- 完成简短的调查并点击提交。
- 接受条款和条件。将显示可用的cuDNN下载版本列表。
- 选择您想要安装的cuDNN版本。将显示可用的资源列表。
请在这里检查TensorFlow GPU的测试构建配置 这里
将以下文件复制到CUDA工具包目录中,并更改文件权限
sudo cp cuda/include/cudnn.h /usr/local/cuda/includesudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
有关更多详细信息,请参考cuDNN安装指南 这里
注意: 更新cuDNN后,如果TensorFlow出现抱怨,请相应地更新TensorFlow