mirror of
https://github.com/explosion/spaCy.git
synced 2024-11-11 04:08:09 +03:00
Fix spacy.util.minibatch
when the size iterator is finished (#6745)
This commit is contained in:
parent
e649242927
commit
28256522c8
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user