MCPcopy Index your code
hub / github.com/zai-org/CodeGeeX / pad_batch

Function pad_batch

codegeex/torch/inference.py:117–124  ·  view source on GitHub ↗
(batch, pad_id, seq_length)

Source from the content-addressed store, hash-verified

115
116
117def pad_batch(batch, pad_id, seq_length):
118 context_lengths = []
119 for tokens in batch:
120 context_length = len(tokens)
121 if context_length < seq_length:
122 tokens.extend([pad_id] * (seq_length - context_length))
123 context_lengths.append(context_length)
124 return batch, context_lengths
125
126
127def forward_step(

Callers 1

get_token_streamFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected