我一直在尝试使用 lda2vec 与 GPU 一起工作,如此处所述
http://nbviewer.jupyter.org/github/cemoody/lda2vec/blob/master/examples/twenty_newsgroups/lda.ipynb#topic=5&lambda=0.6&term=
我已经成功安装了 CUDA、Chainer (1.6.0) 和 CUDNN,但是当我使用 GPU 作为 True 运行程序时,我得到以下信息:
---------------------------------------------------------------------------
CuDNNError Traceback (most recent call last)
<ipython-input-4-29fdc8451bd9> in <module>()
11 model.to_gpu()
12 model.fit(flattened, categorical_features=[doc_ids], fraction=1e-3,
---> 13 epochs=1)
14 model.to_cpu()
15 serializers.save_hdf5('model.hdf5', model)
/usr/local/lib/python2.7/dist-packages/lda2vec-0.1-py2.7.egg/lda2vec/lda2vec.pyc in fit(self, words_flat, categorical_features, targets, epochs, fraction)
436 this_fraction = len(chunk) * 1.0 / words_flat.shape[0]
437 self.fit_partial(chunk, this_fraction,
--> 438 categorical_features=cat_feats)
439
440 def prepare_topics(self, categorical_feature_name, vocab, temperature=1.0):
/usr/local/lib/python2.7/dist-packages/lda2vec-0.1-py2.7.egg/lda2vec/lda2vec.pyc in fit_partial(self, words_flat, fraction, categorical_features, targets)
385 # Before calculating gradients, zero them or we will get NaN
386 self.zerograds()
--> 387 prior_loss = self._priors()
388 words_loss = self._skipgram_flat(words_flat, categorical_features)
389 trget_loss = self._target(vcategorical_features, targets)
/usr/local/lib/python2.7/dist-packages/lda2vec-0.1-py2.7.egg/lda2vec/lda2vec.pyc in _priors(self)
163 embedding, transform, loss_func, penalty = vals
164 name = cat_feat_name + "_mixture"
--> 165 dl = dirichlet_likelihood(self[name].weights)
166 if penalty:
167 factors = self[name].factors.W
/usr/local/lib/python2.7/dist-packages/lda2vec-0.1-py2.7.egg/lda2vec/dirichlet_likelihood.pyc in dirichlet_likelihood(weights, alpha)
30 proportions = F.softmax(weights)
31 else:
---> 32 proportions = F.softmax(weights.W)
33 loss = (alpha - 1.0) * F.log(proportions + 1e-8)
34 return -F.sum(loss)
/usr/local/lib/python2.7/dist-packages/chainer/functions/activation/softmax.pyc in softmax(x, use_cudnn)
90
91 """
---> 92 return Softmax(use_cudnn)(x)
/usr/local/lib/python2.7/dist-packages/chainer/function.pyc in __call__(self, *inputs)
103 # Forward prop
104 with cuda.get_device(*in_data):
--> 105 outputs = self.forward(in_data)
106 assert type(outputs) == tuple
107
/usr/local/lib/python2.7/dist-packages/chainer/functions/activation/softmax.pyc in forward(self, x)
34 one = numpy.array(1, dtype=dtype).ctypes
35 zero = numpy.array(0, dtype=dtype).ctypes
---> 36 handle = cudnn.get_handle()
37 x_cube = x[0].reshape(x[0].shape[:2] + (-1, 1))
38 desc = cudnn.create_tensor_descriptor(x_cube)
/usr/local/lib/python2.7/dist-packages/cupy/cudnn.pyc in get_handle()
16 handle = _handles.get(device.id, None)
17 if handle is None:
---> 18 handle = cudnn.create()
19 _handles[device.id] = handle
20 return handle
cupy/cuda/cudnn.pyx in cupy.cuda.cudnn.create (cupy/cuda/cudnn.cpp:1567)()
cupy/cuda/cudnn.pyx in cupy.cuda.cudnn.create (cupy/cuda/cudnn.cpp:1512)()
cupy/cuda/cudnn.pyx in cupy.cuda.cudnn.check_status (cupy/cuda/cudnn.cpp:1311)()
CuDNNError: CUDNN_STATUS_NOT_INITIALIZED: CUDNN_STATUS_NOT_INITIALIZED
我已将正确的文件复制到 CUDA 目录并在 bashrc 中添加了路径。我没有先前的 GPU 计算问题,因此将不胜感激任何帮助