Chainer 模块“cupy.cudnn”没有属性“softmax_forward”
Posted
技术标签:
【中文标题】Chainer 模块“cupy.cudnn”没有属性“softmax_forward”【英文标题】:Chainer module 'cupy.cudnn' has no attribute 'softmax_forward' 【发布时间】:2019-03-21 18:33:22 【问题描述】:我正在尝试通过 GPU 在chainer 上运行神经网络。但它似乎只是不工作。 我已经尝试了某些版本的 cuda,9.0、10.1、10.0。在我遇到cupy安装问题之前。现在我只是通过 Anaconda 环境安装 cupy。 cuda.to_gpu 和 cupy.array 似乎可以工作
我现在不知道这个问题。
Exception in main training loop: module 'cupy.cudnn' has no attribute 'softmax_forward'
Traceback (most recent call last):
File "C:\Users\81065\Anaconda3\lib\site-packages\chainer\training\trainer.py", line 315, in run
update()
File "C:\Users\81065\Anaconda3\lib\site-packages\chainer\training\updaters\standard_updater.py", line 165, in update
self.update_core()
File "C:\Users\81065\Anaconda3\lib\site-packages\chainer\training\updaters\standard_updater.py", line 177, in update_core
optimizer.update(loss_func, *in_arrays)
File "C:\Users\81065\Anaconda3\lib\site-packages\chainer\optimizer.py", line 680, in update
loss = lossfun(*args, **kwds)
File "C:\Users\81065\Anaconda3\lib\site-packages\chainer\link.py", line 242, in __call__
out = forward(*args, **kwargs)
File "C:\Users\81065\Anaconda3\lib\site-packages\chainer\links\model\classifier.py", line 144, in forward
self.loss = self.lossfun(self.y, t)
File "C:\Users\81065\Anaconda3\lib\site-packages\chainer\functions\loss\softmax_cross_entropy.py", line 382, in softmax_cross_entropy
normalize, cache_score, class_weight, ignore_label, reduce)(x, t)
File "C:\Users\81065\Anaconda3\lib\site-packages\chainer\function.py", line 233, in __call__
ret = node.apply(inputs)
File "C:\Users\81065\Anaconda3\lib\site-packages\chainer\function_node.py", line 263, in apply
outputs = self.forward(in_data)
File "C:\Users\81065\Anaconda3\lib\site-packages\chainer\function.py", line 135, in forward
return self._function.forward(inputs)
File "C:\Users\81065\Anaconda3\lib\site-packages\chainer\function.py", line 340, in forward
return self.forward_gpu(inputs)
File "C:\Users\81065\Anaconda3\lib\site-packages\chainer\functions\loss\softmax_cross_entropy.py", line 127, in forward_gpu
log_y = log_softmax._log_softmax(x)
File "C:\Users\81065\Anaconda3\lib\site-packages\chainer\functions\activation\log_softmax.py", line 30, in _log_softmax
return cudnn.softmax_forward(x, axis, _algorithm)
Will finalize trainer extensions and updater before reraising the exception.
AttributeError Traceback (most recent call last)
而且报错说:
module 'cupy.cudnn' has no attribute 'softmax_forward'
来自chainer.print_runtime_info() 的信息如下所示。
Platform: Windows-10-10.0.17763-SP0
Chainer: 5.3.0
NumPy: 1.13.3
CuPy:
CuPy Version : 4.1.0
CUDA Root : C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0
CUDA Build Version : 9000
CUDA Driver Version : 10010
CUDA Runtime Version : 9000
cuDNN Build Version : 7104
cuDNN Version : 7402
NCCL Build Version : None
iDeep: Not Available
AttributeError: module 'cupy.cudnn' has no attribute 'softmax_forward'
遵循@corochann 的建议。我已经重新安装并更新了chainer,但现在我无法安装cupy。下面是chainer.print_runtime_info()。
Platform: Windows-10-10.0.17763-SP0
Chainer: 5.3.0
NumPy: 1.13.3
CuPy: Not Available
iDeep: Not Available
None
当我尝试安装 cupy。发生了这样的事情。
Build Environment:
Include directories: ['C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.0\\include', 'C:\\Program Files\\NVIDIA Corporation\\NvToolsExt\\include']
Library directories: ['C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.0\\bin', 'C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.0\\lib\\x64', 'C:\\Program Files\\NVIDIA Corporation\\NvToolsExt\\lib\\x64']
nvcc command : ['C:\\Program Files\\NVIDIA GPU Computing Toolkit\\CUDA\\v9.0\\bin/nvcc.exe']
Environment Variables:
CFLAGS : C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include\
LDFLAGS : C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\lib\
LIBRARY_PATH : (none)
CUDA_PATH : C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0
NVTOOLSEXT_PATH : C:\Program Files\NVIDIA Corporation\NvToolsExt\
NVCC : (none)
Modules:
cuda : No
-> Include files not found: ['cublas_v2.h', 'cuda.h', 'cuda_profiler_api.h', 'cuda_runtime.h', 'cufft.h', 'curand.h', 'cusparse.h', 'nvrtc.h']
-> Check your CFLAGS environment variable.
ERROR: CUDA could not be found on your system.
Please refer to the Installation Guide for details:
https://docs-cupy.chainer.org/en/stable/install.html
************************************************************
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "C:\Users\81065\AppData\Local\Temp\pip-install-73rgt_6r\cupy\setup.py", line 120, in <module>
ext_modules = cupy_setup_build.get_ext_modules()
File "C:\Users\81065\AppData\Local\Temp\pip-install-73rgt_6r\cupy\cupy_setup_build.py", line 588, in get_ext_modules
extensions = make_extensions(arg_options, compiler, use_cython)
File "C:\Users\81065\AppData\Local\Temp\pip-install-73rgt_6r\cupy\cupy_setup_build.py", line 384, in make_extensions
raise Exception('Your CUDA environment is invalid. '
Exception: Your CUDA environment is invalid. Please check above error log.
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\81065\AppData\Local\Temp\pip-install-73rgt_6r\cupy\
【问题讨论】:
您的 Chainer 和 Cupy 版本似乎不匹配。可以试试pip uninstall cupy
和pip install cupy-cuda90==5.3.0 --no-cache-dir
安装相同版本的cupy & chainer 吗?
我卸载了cupy并更新了chainer。但是,我无法重新安装cupy。 '平台:Windows-10-10.0.17763-SP0 Chainer:5.3.0 NumPy:1.13.3 CuPy:不可用 iDeep:不可用 无'
命令“python setup.py egg_info”在 C:\Users\81065\AppData\Local\Temp\pip-install-0ay7h8s8\cupy\ 中失败,错误代码为 1。这是我使用 pip install cupy 时收到的错误
@DaleLin 你有没有听从@corochann 的指示?他说的是cupy-cuda90==5.3.0
,而不是cupy
。
@DaleLin 也不(官方)支持 Windows。 (docs-cupy.chainer.org/en/stable/…)
【参考方案1】:
正如@corochann 所说,这是由chainer
和cupy
之间的版本不匹配引起的。 cupy==v4.1.0
不持有cupy.cudnn.softmax_forward
。
对比v5.3.0和v4.1.0的源码可以找到。
【讨论】:
以上是关于Chainer 模块“cupy.cudnn”没有属性“softmax_forward”的主要内容,如果未能解决你的问题,请参考以下文章