IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

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.