Improve efficiency of tagger.set_annotations for GPU

This commit is contained in:
Matthew Honnibal 2017-08-12 08:54:21 -05:00
parent ebe0f7f641
commit 680043ebca
1 changed files with 2 additions and 0 deletions

View File

@ -284,6 +284,8 @@ class NeuralTagger(BaseThincComponent):
cdef Vocab vocab = self.vocab
for i, doc in enumerate(docs):
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):
# Don't clobber preset POS tags
if doc.c[j].tag == 0 and doc.c[j].pos == 0: