add oversize examples before StopIteration returns

This commit is contained in:
svlandeg 2020-06-02 13:21:55 +02:00
parent b5ae2edcba
commit ec52e7f886

View File

@ -681,6 +681,9 @@ def minibatch_by_words(examples, size, tuples=True, count_words=len, tolerance=0
try: try:
example = next(examples) example = next(examples)
except StopIteration: except StopIteration:
if oversize:
example = oversize.pop(0)
batch.append(example)
if batch: if batch:
yield batch yield batch
return return