Spacy-在预训练模型上添加新实体在CPU上有效,但在GPU上无效

时间:2019-01-03 12:43:10

标签: spacy

我想将新实体添加到预训练模型中。我可以在CPU上(耗时)执行此操作,但不能在GPU上执行。

注意-使用实体进行训练时,在GPU上进行训练的效果很好,但是如果我添加很少的新实体,则会崩溃。

以下是错误跟踪:-

54 @check.arg(1, has_shape(('nB', 'nI')))
55 def begin_update(self, input__BI, drop=0.):
---> 56 output__BO = self.predict(input__BI)
57 def finish_update(grad__BO, sgd=None):
58 self.d_W += self.ops.batch_outer(grad__BO, input__BI)

~/Downloads/program_files/anaconda3/envs/spacy/lib/python3.6/site-packages/thinc/check.py in checked_function(wrapped, instance, args, kwargs)
144 raise ExpectedTypeError(check, ['Callable'])
145 check(arg_id, fix_args, kwargs)
--> 146 return wrapped(*args, **kwargs)
147
148 def arg_check_adder(func):

~/Downloads/program_files/anaconda3/envs/spacy/lib/python3.6/site-packages/thinc/neural/_classes/affine.py in predict(self, input__BI)
50 @check.arg(1, has_shape(('nB', 'nI')))
51 def predict(self, input__BI):
---> 52 return self.ops.affine(self.W, self.b, input__BI)
53
54 @check.arg(1, has_shape(('nB', 'nI')))

ops.pyx in thinc.neural.ops.Ops.affine()
ops.pyx in thinc.neural.ops.Ops.batch_dot()

~/Downloads/program_files/anaconda3/envs/spacy/lib/python3.6/site-packages/cupy/linalg/product.py in dot(a, b, out)
33 """
34 # TODO(okuta): check type
---> 35 return a.dot(b, out)
36
37
cupy/core/core.pyx in cupy.core.core.ndarray.array()
cupy/core/core.pyx in cupy.core.core.ndarray.astype()
cupy/core/_kernel.pyx in cupy.core._kernel.ufunc.call()
cupy/util.pyx in cupy.util.memoize.decorator.ret()
cupy/core/_kernel.pyx in cupy.core._kernel._get_ufunc_kernel()
cupy/core/_kernel.pyx in cupy.core._kernel._get_kernel_params()
cupy/core/_scalar.pyx in cupy.core._scalar.get_typename()
cupy/core/_scalar.pyx in cupy.core.scalar.get_typename()
KeyError: <class 'numpy.object'>

Your Environment
Info about spaCy
spaCy version: 2.0.18
Platform: Linux-4.15.0-39-generic-x86_64-with-debian-stretch-sid
Python version: 3.6.6
Models: en, en_core_web_md
Please Help.

0 个答案:

没有答案