MCPcopy Create free account
hub / github.com/OpenBMB/AgentCPM-GUI / pad_batch

Function pad_batch

eval/utils/utils_odyssey/qwen_generation_utils.py:25–30  ·  view source on GitHub ↗
(batch: BatchTokensType, pad_id: int, seq_length: int)

Source from the content-addressed store, hash-verified

23
24
25def pad_batch(batch: BatchTokensType, pad_id: int, seq_length: int) -> BatchTokensType:
26 for tokens in batch:
27 context_length = len(tokens)
28 if context_length < seq_length:
29 tokens.extend([pad_id] * (seq_length - context_length))
30 return batch
31
32
33def get_ltor_masks_and_position_ids(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected