加载模型权重后CuDNN库兼容性错误

问题描述 投票:7回答:3

我正在尝试加载NSynth权重,我正在使用tf版本1.7.0

from magenta.models.nsynth import utils
from magenta.models.nsynth.wavenet import fastgen

def wavenet_encode(file_path):

 # Load the model weights.
 checkpoint_path = './wavenet-ckpt/model.ckpt-200000'

 # Load and downsample the audio.
 neural_sample_rate = 16000
 audio = utils.load_audio(file_path, 
                          sample_length=400000, 
                          sr=neural_sample_rate)

 encoding = fastgen.encode(audio, checkpoint_path, len(audio))

 # Reshape to a single sound.
 return encoding.reshape((-1, 16))

# An array of n * 16 frames. 
wavenet_z_data = wavenet_encode(file_path)

我收到以下错误:

tensorflow / stream_executor / cuda / cuda_dnn.cc:396]加载的运行时CuDNN库:7103(兼容版本7100),但源代码是用7005编译的(兼容版本7000)。如果使用二进制安装,请升级您的CuDNN库以匹配。如果从源构建,请确保在运行时加载的库与编译配置期间指定的兼容版本匹配。

我应该怎么做,我应该安装哪个版本的tf,以及我需要哪个CUDA版本?

tensorflow cudnn magenta
3个回答
9
投票

如错误所示,您使用的Tensorflow版本是针对CuDNN 7.0.5编译的,而您的系统安装了CuDNN 7.1.3。

正如错误也暗示,您可以解决此问题:


6
投票

在env:

ubuntu16.04   
cuda9.0   
cudnn7.0  
tensorflow 1.11.0  
python 3.5

我尝试用tensorflow训练对象检测,我遇到了这个问题:

2018-10-18 21:31:36.796017: E tensorflow/stream_executor/cuda/cuda_dnn.cc:343] Loaded runtime CuDNN library: 7.0.5 but source was compiled with: 7.2.1.  CuDNN library major and minor version needs to match or have higher minor version in case of CuDNN 7.0 or later version. If using a binary install, upgrade your CuDNN library.  If building from sources, make sure the library loaded at runtime is compatible with the version specified during compile configuration.
Segmentation fault (core dumped)

这是因为tensorflow版本更高;

我使用pip3 install --upgrade --force-reinstall tensorflow-gpu==1.9.0 --user来解决问题。


0
投票

我建议安装cudnn编译的tensorflow版本:

sudo apt install libcudnn7-dev=7.0.5.15-1+cuda<x> libcudnn7=7.0.5.15-1+cuda<x>

<x>符号必须替换为cuda版本,例如:对于cuda版本9.09.0替换它。

稍后冻结apt中不会自动更新的版本:

sudo apt-mark hold libcudnn7 libcudnn7-dev
© www.soinside.com 2019 - 2024. All rights reserved.