MCPcopy Create free account
hub / github.com/HA-Transformer/MAT / batch_by_size

Function batch_by_size

fairseq/data/data_utils.py:180–237  ·  view source on GitHub ↗

Yield mini-batches of indices bucketed by size. Batches may contain sequences of different lengths. Args: indices (List[int]): ordered list of dataset indices num_tokens_fn (callable): function that returns the number of tokens at a given index max_t

(
    indices, num_tokens_fn, max_tokens=None, max_sentences=None,
    required_batch_size_multiple=1,
)

Source from the content-addressed store, hash-verified

source not stored for this graph (policy: none)

Callers

nothing calls this directly

Calls 1

is_batch_fullFunction · 0.85

Tested by

no test coverage detected