MCPcopy Create free account
hub / github.com/OpenBitSys/BitDistiller / _collate

Method _collate

test/general/lm_eval/base.py:275–284  ·  view source on GitHub ↗
(x)

Source from the content-addressed store, hash-verified

273 res = []
274
275 def _collate(x):
276 # the negative sign on len(toks) sorts descending - this has a few advantages:
277 # - time estimates will always be over not underestimates, which is more useful for planning
278 # - to know the size of a batch when going through the list, you know the first one is always the batch
279 # padded context length. this is useful to simplify the batching logic and more importantly to make
280 # automatic adaptive batches much much easier to implement
281 # - any OOMs will happen right away rather than near the end
282
283 toks = x[1] + x[2]
284 return -len(toks), tuple(toks)
285
286 re_ord = utils.Reorderer(requests, _collate)
287

Callers

nothing calls this directly

Calls 1

tok_encodeMethod · 0.95

Tested by

no test coverage detected