Fix batch bug in issue #3344

This commit is contained in:
Matthew Honnibal 2019-03-10 16:01:34 +01:00
parent 8a6272f842
commit 7461e5e055
1 changed files with 1 additions and 1 deletions

View File

@ -221,7 +221,7 @@ cdef class Parser:
for batch in util.minibatch(docs, size=batch_size): for batch in util.minibatch(docs, size=batch_size):
batch_in_order = list(batch) batch_in_order = list(batch)
by_length = sorted(batch_in_order, key=lambda doc: len(doc)) by_length = sorted(batch_in_order, key=lambda doc: len(doc))
for subbatch in util.minibatch(by_length, size=batch_size//4): for subbatch in util.minibatch(by_length, size=max(batch_size//4, 2)):
subbatch = list(subbatch) subbatch = list(subbatch)
parse_states = self.predict(subbatch, beam_width=beam_width, parse_states = self.predict(subbatch, beam_width=beam_width,
beam_density=beam_density) beam_density=beam_density)