Skip to main content

Python module

max.pipelines.modeling.dataprocessing

Batch collationโ€‹

PaddingDirectionPadding (from) direction for batch collation.
batch_padded_tokens_and_maskBatches input tokens and computes a batched attention mask.
collate_batchGenerates a single batch tensor from a batch of inputs.

Attention masksโ€‹

causal_attention_maskBuilds a causal attention mask for a batch of variable-length sequences.
causal_attention_mask_with_token_maskBuilds a causal attention mask and additionally masks invalid tokens.

Utilitiesโ€‹

max_tokens_to_generateReturns the maximum number of new tokens to generate.