1

我正在尝试通过 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\
4

1 回答 1

2

正如@corochann 所提到的,这是由 和 之间的版本不匹配引起chainercupycupy==v4.1.0不成立cupy.cudnn.softmax_forward

您可以通过对比v5.3.0v4.1.0的源代码找到它。

于 2019-03-22T02:17:34.677 回答