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)
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:
-
- models (ModelManifest | None)
- config_file (str | None)
- section_name (str | None)
- model_override (list[str])
- task (PipelineTask)
- debug_verify_replay (bool)
- tokenizer_impl (str | None)
- model_path (str)
- served_model_name (str | None)
- weight_path (list[Path])
- quantization_encoding (Literal['float32', 'float16', 'bfloat16', 'q4_k', 'q4_0', 'q6_k', 'float8_e4m3fn', 'float4_e2m1fnx2', 'float6_e2m3fn', 'gptq'] | None)
- huggingface_model_revision (str)
- huggingface_weight_revision (str)
- trust_remote_code (bool)
- subfolder (str | None)
- device_specs (list[DeviceSpec])
- force_download (bool)
- vision_config_overrides (dict[str, Any])
- rope_type (Literal['none', 'normal', 'neox', 'longrope', 'yarn'] | None)
- sliding_window (int | None)
- enable_echo (bool)
- chat_template (Path | None)
- use_subgraphs (bool)
- data_parallel_degree (int)
- pool_embeddings (bool)
- max_length (int | None)
- kv_cache (KVCacheConfig)
- runtime (PipelineRuntimeConfig)
- denoising_cache (DenoisingCacheSettings)
- sampling (SamplingConfig)
- profiling (ProfilingConfig)
- lora (LoRAConfig | None)
- speculative (SpeculativeConfig | None)
- draft_model (MAXModelConfig | None)
chat_template
chat_template: Path | None
config_file
Path to the configuration file.
data_parallel_degree
data_parallel_degree: int
debug_verify_replay
debug_verify_replay: bool
denoising_cache
denoising_cache: DenoisingCacheSettings
User denoising-cache settings. Construction fills unset fields.
device_specs
device_specs: list[DeviceSpec]
draft_model
draft_model: MAXModelConfig | None
enable_echo
enable_echo: bool
force_download
force_download: bool
from_flat_kwargs()
classmethod from_flat_kwargs(**kwargs)
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-filemerge, so CLI flags and config-file subtrees reconcile per field. - A config file’s
model:section (thePipelineConfigschema shape) is folded into the flat model fields; explicit CLI kwargs win per field,--model-overrideentries win over both. draft_-prefixed kwargs builddraft_model, inheritingtrust_remote_code/device_specs/data_parallel_degreefrom 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
PipelineArgspopulated from the flat kwargs. -
Return type:
huggingface_model_revision
huggingface_model_revision: str
huggingface_weight_revision
huggingface_weight_revision: str
kv_cache
kv_cache: KVCacheConfig
lora
lora: LoRAConfig | None
main_architecture_name
property main_architecture_name: str
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
model_config
model_config: ClassVar[ConfigDict] = {'arbitrary_types_allowed': True, 'extra': 'forbid', 'frozen': True, 'strict': False}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
model_override
model_path
model_path: str
model_post_init()
model_post_init(context, /)
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
profiling
profiling: ProfilingConfig
quantization_encoding
quantization_encoding: SupportedEncoding | None
rope_type
runtime
runtime: PipelineRuntimeConfig
sampling
sampling: SamplingConfig
section_name
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
sliding_window
speculative
speculative: SpeculativeConfig | None
subfolder
task
task: PipelineTask
tokenizer_impl
trust_remote_code
trust_remote_code: bool
use_subgraphs
use_subgraphs: bool
vision_config_overrides
weight_path
weight_path: list[Path]