mirror of
https://github.com/explosion/spaCy.git
synced 2024-12-26 18:06:29 +03:00
add oversize examples before StopIteration returns
This commit is contained in:
parent
b5ae2edcba
commit
ec52e7f886
|
@ -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
|
||||||
|
|
Loading…
Reference in New Issue
Block a user