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.PipelineArgs(*, models=None, config_file=None, section_name=None, model_override=<factory>, task=PipelineTask.UNDEFINED, debug_verify_replay=False, 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>, 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.
-
Parameters:
-
- models (ModelManifest | None)
- config_file (str | None)
- section_name (str | None)
- model_override (list[str])
- task (PipelineTask)
- debug_verify_replay (bool)
- 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)
- sampling (SamplingConfig)
- profiling (ProfilingConfig)
- lora (LoRAConfig | None)
- speculative (SpeculativeConfig | None)
- draft_model (MAXModelConfig | None)
chat_templateβ
chat_template: Path | None
data_parallel_degreeβ
data_parallel_degree: int
debug_verify_replayβ
debug_verify_replay: bool
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', '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
served_model_nameβ
sliding_windowβ
speculativeβ
speculative: SpeculativeConfig | None
subfolderβ
taskβ
task: PipelineTask
trust_remote_codeβ
trust_remote_code: bool
use_subgraphsβ
use_subgraphs: bool
vision_config_overridesβ
weight_pathβ
weight_path: list[Path]