当我执行nlp.begin_training()时,出现以下错误

时间:2019-06-05 05:42:48

标签: spacy

“我正在尝试使用spacy训练ner模型。它在CPU上正常工作。但是,当我尝试使用GPU执行该模型时,出现以下错误。Spacy版本2.1.4,CUDA版本10.1”

“我尝试重新安装Thinc,但仍然出现错误”

from __future__ import unicode_literals, print_function
import plac
import random
from pathlib import Path
import spacy
from spacy.util import minibatch, compounding
import json
spacy.require_gpu()
nlp = spacy.blank("en")
ner = nlp.create_pipe("ner")
ner = nlp.create_pipe("ner")
for _, annotations in TRAIN_DATA:
    for ent in annotations.get("entities"):
        ner.add_label(ent[2])
optimizer = nlp.begin_training()

“我遇到以下错误”

“ CUDARuntimeError
追溯(最近一次通话)  在 ----> 1 optimizer = nlp.begin_training()

begin_training(self, get_gold_tuples, sgd, component_cfg, **cfg)中的G:\ Anaconda3 \ lib \ site-packages \ spacy \ language.py

    547             if self.vocab.vectors.data.shape[1] >= 1:
    548                 self.vocab.vectors.data = Model.ops.asarray(self.vocab.vectors.data)
--> 549         link_vectors_to_models(self.vocab)
    550         if self.vocab.vectors.data.shape[1]:
    551             cfg["pretrained_vectors"] = self.vocab.vectors.name

link_vectors_to_models(vocab)中的G:\ Anaconda3 \ lib \ site-packages \ spacy_ml.py

    297         else:
    298             word.rank = 0
--> 299     data = ops.asarray(vectors.data)
    300     # Set an entry here, so that vectors are accessed by StaticVectors
    301     # (unideal, I know)

ops.pyx in thinc.neural.ops.CupyOps.asarray()

array(obj, dtype, copy, order, subok, ndmin)中的G:\ Anaconda3 \ lib \ site-packages \ cupy \ creation \ from_data.py

     39 
     40     """
---> 41     return core.array(obj, dtype, copy, order, subok, ndmin)
     42 
     43 

cupy.core.core.array()中的cupy \ core \ core.pyx

cupy.core.core.array()中的cupy \ core \ core.pyx

cupy.core.core.ndarray.__init__()中的cupy \ core \ core.pyx

cupy.cuda.memory.alloc()中的cupy \ cuda \ memory.pyx

cupy.cuda.memory.MemoryPool.malloc()中的cupy \ cuda \ memory.pyx

cupy.cuda.memory.MemoryPool.malloc()中的cupy \ cuda \ memory.pyx

cupy.cuda.device.get_device_id()中的cupy \ cuda \ device.pyx

cupy.cuda.runtime.getDevice()中的cupy \ cuda \ runtime.pyx

cupy.cuda.runtime.check_status()中的cupy \ cuda \ runtime.pyx

CUDARuntimeError:cudaErrorUnknown:未知错误”

0 个答案:

没有答案