From 28256522c8a6311e6a20d66927ef2bd230755464 Mon Sep 17 00:00:00 2001 From: Santiago Castro Date: Sun, 17 Jan 2021 08:48:43 -0300 Subject: [PATCH] Fix `spacy.util.minibatch` when the size iterator is finished (#6745) --- spacy/util.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spacy/util.py b/spacy/util.py index 95a9f087f..6cf87bcac 100644 --- a/spacy/util.py +++ b/spacy/util.py @@ -513,7 +513,7 @@ def minibatch(items, size=8): size_ = size items = iter(items) while True: - batch_size = next(size_) + batch_size = next(size_, 0) # StopIteration isn't handled in generators in Python >= 3.7. batch = list(itertools.islice(items, int(batch_size))) if len(batch) == 0: break