From ec52e7f886ad3839bb509c38707a8ae4e955b7d4 Mon Sep 17 00:00:00 2001 From: svlandeg Date: Tue, 2 Jun 2020 13:21:55 +0200 Subject: [PATCH] add oversize examples before StopIteration returns --- spacy/util.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spacy/util.py b/spacy/util.py index 79134400c..54ecb6edd 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -681,6 +681,9 @@ def minibatch_by_words(examples, size, tuples=True, count_words=len, tolerance=0 try: example = next(examples) except StopIteration: + if oversize: + example = oversize.pop(0) + batch.append(example) if batch: yield batch return