mirror of https://github.com/explosion/spaCy.git
Improve efficiency of tagger.set_annotations for GPU
This commit is contained in:
parent
ebe0f7f641
commit
680043ebca
|
@ -284,6 +284,8 @@ class NeuralTagger(BaseThincComponent):
|
||||||
cdef Vocab vocab = self.vocab
|
cdef Vocab vocab = self.vocab
|
||||||
for i, doc in enumerate(docs):
|
for i, doc in enumerate(docs):
|
||||||
doc_tag_ids = batch_tag_ids[i]
|
doc_tag_ids = batch_tag_ids[i]
|
||||||
|
if hasattr(doc_tag_ids, 'get'):
|
||||||
|
doc_tag_ids = doc_tag_ids.get()
|
||||||
for j, tag_id in enumerate(doc_tag_ids):
|
for j, tag_id in enumerate(doc_tag_ids):
|
||||||
# Don't clobber preset POS tags
|
# Don't clobber preset POS tags
|
||||||
if doc.c[j].tag == 0 and doc.c[j].pos == 0:
|
if doc.c[j].tag == 0 and doc.c[j].pos == 0:
|
||||||
|
|
Loading…
Reference in New Issue