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 class

PipelineArgs

PipelineArgs​

class max.pipelines.lib.PipelineArgs(*, models=None, config_file=None, section_name=None, model_override=<factory>, task=PipelineTask.UNDEFINED, debug_verify_replay=False, tokenizer_impl=None, model_path='', served_model_name=None, weight_path=<factory>, quantization_encoding=None, huggingface_model_revision='main', huggingface_weight_revision='main', trust_remote_code=False, subfolder=None, device_specs=<factory>, force_download=False, vision_config_overrides=<factory>, rope_type=None, sliding_window=None, enable_echo=False, chat_template=None, use_subgraphs=True, data_parallel_degree=1, pool_embeddings=True, max_length=None, kv_cache=<factory>, runtime=<factory>, denoising_cache=<factory>, sampling=<factory>, profiling=<factory>, lora=None, speculative=None, draft_model=None)

source

Bases: ConfigFileModel

User-settable input arguments for a pipeline.

PipelineArgs is the user-facing input to the pipeline system. It holds flat model-level fields plus nested sub-configs mirroring the PipelineConfig schema (runtime, sampling, profiling) and a small number of cohesive sub-config objects (kv_cache, lora, speculative, draft_model).

Multi-component pipelines (e.g. diffusion) that require a pre-built ModelManifest may pass models=<manifest> to the constructor. That manifest is stored as a private override and used verbatim by PipelineConfig.from_args() instead of constructing one from the flat scalar fields.

Call PipelineConfig.from_args() to obtain a fully-constructed PipelineConfig ready for architecture-driven resolution.

Instances are immutable: assigning to a field after construction raises a pydantic ValidationError.

Parameters:

chat_template​

chat_template: Path | None

source

config_file​

config_file: str | None

source

Path to the configuration file.

data_parallel_degree​

data_parallel_degree: int

source

debug_verify_replay​

debug_verify_replay: bool

source

denoising_cache​

denoising_cache: DenoisingCacheSettings

source

User denoising-cache settings. Construction fills unset fields.

device_specs​

device_specs: list[DeviceSpec]

source

draft_model​

draft_model: MAXModelConfig | None

source

enable_echo​

enable_echo: bool

source

force_download​

force_download: bool

source

from_flat_kwargs()​

classmethod from_flat_kwargs(**kwargs)

source

Construct a PipelineArgs from a flat CLI kwargs namespace.

Owns the full flat-to-nested routing for CLI and legacy callers:

  • Flat sub-config kwargs (e.g. max_batch_size, enable_lora, num_speculative_tokens) are nested under their sub-config section (runtime, lora, speculative, …) before the --config-file merge, so CLI flags and config-file subtrees reconcile per field.
  • A config file’s model: section (the PipelineConfig schema shape) is folded into the flat model fields; explicit CLI kwargs win per field, --model-override entries win over both.
  • draft_-prefixed kwargs build draft_model, inheriting trust_remote_code/device_specs/data_parallel_degree from the target model when unset.
  • Multi-component (e.g. diffusion) model paths are detected via ModelManifest.from_model_path() and carried as a manifest override.

Parameters:

**kwargs (Any) – Flat keyword arguments, e.g. model_path, kv_cache_size, enable_lora.

Returns:

A PipelineArgs populated from the flat kwargs.

Return type:

Self

huggingface_model_revision​

huggingface_model_revision: str

source

huggingface_weight_revision​

huggingface_weight_revision: str

source

kv_cache​

kv_cache: KVCacheConfig

source

lora​

lora: LoRAConfig | None

source

main_architecture_name​

property main_architecture_name: str

source

Returns the HuggingFace architecture class name for the main model.

Reads architectures[0] from the model’s HuggingFace config without constructing a full PipelineConfig.

Raises:

ValueError – If the architecture name cannot be determined.

max_length​

max_length: int | None

source

model_config​

model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': True, 'strict': False}

source

Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].

model_override​

model_override: list[str]

source

model_path​

model_path: str

source

model_post_init()​

model_post_init(context, /)

source

This function is meant to behave like a BaseModel method to initialise private attributes.

It takes context as an argument since that’s what pydantic-core passes when calling it.

Parameters:

  • self (BaseModel) – The BaseModel instance.
  • context (Any) – The context.

Return type:

None

pool_embeddings​

pool_embeddings: bool

source

profiling​

profiling: ProfilingConfig

source

quantization_encoding​

quantization_encoding: SupportedEncoding | None

source

rope_type​

rope_type: RopeType | None

source

runtime​

runtime: PipelineRuntimeConfig

source

sampling​

sampling: SamplingConfig

source

section_name​

section_name: str | None

source

Optional section name for comprehensive/multi-section config files.

If not provided, values are loaded from the YAML top-level (treating the file as an “individual config” file).

served_model_name​

served_model_name: str | None

source

sliding_window​

sliding_window: int | None

source

speculative​

speculative: SpeculativeConfig | None

source

subfolder​

subfolder: str | None

source

task​

task: PipelineTask

source

tokenizer_impl​

tokenizer_impl: str | None

source

trust_remote_code​

trust_remote_code: bool

source

use_subgraphs​

use_subgraphs: bool

source

vision_config_overrides​

vision_config_overrides: dict[str, Any]

source

weight_path​

weight_path: list[Path]

source