MCPcopy Create free account
hub / github.com/InternScience/SciReason / batched

Function batched

opencompass/utils/auxiliary.py:8–14  ·  view source on GitHub ↗
(iterable, n)

Source from the content-addressed store, hash-verified

6except ImportError:
7
8 def batched(iterable, n):
9 # batched('ABCDEFG', 3) --> ABC DEF G
10 if n < 1:
11 raise ValueError('n must be at least one')
12 it = iter(iterable)
13 while batch := tuple(islice(it, n)):
14 yield batch

Callers 2

_launch_wo_debugMethod · 0.90
inferenceMethod · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected