IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /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. /get-started.md).

Python module

max.pipelines

Interfaces for running models end to end: registry, configuration, and pipeline classes for text, embeddings, and pixel generation.

A pipeline wires a model family into an executable workflow. A SupportedArchitecture registers the model in the pipeline registry, PipelineConfig sets how it runs, and pipeline classes such as TextGenerationPipeline, EmbeddingsPipeline, and PixelGenerationPipeline drive tokenization, weight loading, and generation.

Submodules​

max.pipelines.architecturesBuilt-in model architectures for MAX pipelines.
max.pipelines.audioAudio generation pipelines.
max.pipelines.contextRequest contexts and supporting types for MAX pipelines.
max.pipelines.diffusionDiffusion-specific pipeline components.
max.pipelines.kv_cacheKV cache management for MAX pipelines.
max.pipelines.libTypes to interface with ML pipelines such as text/token generation.
max.pipelines.lib.arch_lookupArchitecture registration and lookup tables.
max.pipelines.lib.interfacesInterfaces for MAX pipelines.
max.pipelines.lib.log_probabilitiesBuilds computation graphs for log probabilities over batched input sequences.
max.pipelines.lib.registryModel registry, for tracking various model variants.
max.pipelines.modeling.baseBase classes for MAX pipeline model definitions.
max.pipelines.modeling.dataprocessingToken-batch preparation helpers: collation, padding, and attention masks.
max.pipelines.modeling.typesPipeline modeling types: request/input/pipeline interfaces.
max.pipelines.weightsWeight loading utilities for MAX pipelines.
max.pipelines.loraLoRA adapter management for MAX pipelines.
max.pipelines.requestRequest types for MAX API.
max.pipelines.samplingToken sampling for MAX pipelines: samplers, logits processors, and the acceptance runners used in speculative decoding.
max.pipelines.speculativeSpeculative decoding pipelines and configuration for MAX.

Configuration​

KVCacheConfigConfiguration for the paged KV cache.
MAXModelConfigConfiguration for a pipeline model.
PipelineArgsUser-settable input arguments for a pipeline.
PipelineConfigConfiguration for a pipeline.
PipelineRuntimeConfigModel-agnostic runtime settings for pipeline execution.
ProfilingConfigConfiguration for the GPU (NVTX/Nsight) profiler and kernel tracing.
SamplingConfigConfiguration for the sampling stage of token generation.
SpeculativeConfigConfigures speculative decoding for a pipeline.

In-process generation​

AutoModelLoads a text generation model in-process.
AutoPipelineGenerates text from text with an AutoModel.
AutoTokenizerLoads the Hugging Face tokenizer serve uses to encode a model's text.

Pipelines​

EmbeddingsPipelineGeneralized token generator pipeline.
PixelGenerationPipelinePixel generation pipeline for diffusion models.
TextGenerationPipelineGeneralized token generator pipeline.
TextGenerationPipelineInterfaceInterface for text generation pipelines.

Model interface​

MemoryEstimatorPlans device memory for a pipeline and estimates what it will use.
ModelInputsBase class for model inputs.
ModelOutputsPipeline model outputs.
PipelineModelA pipeline model with setup, input preparation and execution methods.

Eager usage validation​

The eager usage validator adds guard rails around eager code running inside a compiled pipeline. Configure it with the runtime.eager_usage_validator MAX config setting.

EagerUsageValidatorA scope that tracks production-unsafe API usages.
EagerValidatorModeConfigures when the eager usage validator runs.
PhaseWhich part of a pipeline's life a validation scope covers.
eager_usage_validatorBuilds the validator guarding phase, per the configured mode.
eager_validatorUse to opt in to the escape hatches for EagerUsageValidator.

Tokenizers​

IdentityPipelineTokenizerA pass-through tokenizer that returns prompts unchanged.
TextAndVisionTokenizerEncapsulates creation of TextAndVisionContext and specific token encode/decode logic.
TextTokenizerEncapsulates creation of TextContext and specific token encode/decode logic.

Enums​

PipelineRoleIndicates whether the pipeline should do prefill and/or decode.
PrometheusMetricsModeControls the Prometheus metrics mode.
RepoTypeSpecifies the source location type of a model repository.
RopeTypeThe rotary position embedding (RoPE) implementation a model configures.
SupportedEncodingAll possible encodings which may be supported by a particular model.

Utilities​

download_weight_filesDownloads weight files for a Hugging Face model and returns local paths.
is_float4_encodingReturns whether the given encoding is a float4 type.
parse_supported_encoding_from_file_nameInfers a SupportedEncoding from a file name string.
supported_encoding_dtypeReturns the underlying model dtype for the given encoding.
supported_encoding_quantizationReturns the QuantizationEncoding for the given encoding.
supported_encoding_supported_devicesReturns the devices that the given encoding is supported on.
supported_encoding_supported_onReturns whether the given encoding is supported on a device.
upper_bounded_defaultReturns a value not exceeding the upper bound.
ADAPTER_CONFIG_FILEFile name of the LoRA adapter's config file inside the adapter's local directory, read when the adapter is loaded.