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 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, 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>, pipeline_role='prefill_and_decode', max_batch_size=None, max_queue_size_tg=None, min_batch_size_tg=None, ep_size=1, ep_use_allreduce=False, eplb_profile=<factory>, ce_delay_ms=0.0, enable_prioritize_first_decode=False, enable_chunked_prefill=True, enable_in_flight_batching=False, eplb_replicas_per_gpu=0, max_num_steps=1, max_batch_input_tokens=8192, use_experimental_kernels='false', use_vendor_blas='false', use_vendor_ccl='false', custom_architectures=<factory>, execute_empty_batches=False, max_batch_total_tokens=None, device_graph_capture=None, force=False, kvcache_ce_watermark=0.95, decode_stall_timeout_s=None, decode_request_ttl_s=None, enable_overlap_scheduler=False, allow_unsupported_logprobs=False, allow_extra_request_fields=False, prefer_module_v3=False, reasoning_parser=None, tool_parser=None, emit_reasoning_content=False, temperature=None, thinking_temperature=None, max_vision_cache_entries=256, denoising_cache=<factory>, in_dtype=float32, out_dtype=float32, enable_structured_output=False, structured_output_backend='llguidance', enable_variable_logits=False, enable_penalties=False, enable_min_tokens=False, sample_on_host=False, gpu_profiling='off', profiling_enabled=False, profiling_output_path=None, profiling_dynolog_enabled=True, profiling_warmup_steps=0, profiling_active_steps=10, profiling_periodic_flush_seconds=60, lora=None, speculative=None, draft_model=None)
Bases: ConfigFileModel
Flat, user-settable input arguments for a pipeline.
PipelineArgs is the user-facing input to the pipeline system. It
holds only scalar fields 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', '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)
- pipeline_role (Literal['prefill_and_decode', 'prefill_only', 'decode_only'])
- max_batch_size (int | None)
- max_queue_size_tg (int | None)
- min_batch_size_tg (int | None)
- ep_size (int)
- ep_use_allreduce (bool)
- eplb_profile (bool)
- ce_delay_ms (float)
- enable_prioritize_first_decode (bool)
- enable_chunked_prefill (bool)
- enable_in_flight_batching (bool)
- eplb_replicas_per_gpu (int)
- max_num_steps (int)
- max_batch_input_tokens (int)
- use_experimental_kernels (str)
- use_vendor_blas (str)
- use_vendor_ccl (str)
- custom_architectures (list[str])
- execute_empty_batches (bool)
- max_batch_total_tokens (int | None)
- device_graph_capture (bool | None)
- force (bool)
- kvcache_ce_watermark (float)
- decode_stall_timeout_s (float | None)
- decode_request_ttl_s (float | None)
- enable_overlap_scheduler (bool)
- allow_unsupported_logprobs (bool)
- allow_extra_request_fields (bool)
- prefer_module_v3 (bool)
- reasoning_parser (str | None)
- tool_parser (str | None)
- emit_reasoning_content (bool)
- temperature (float | None)
- thinking_temperature (float | None)
- max_vision_cache_entries (int)
- denoising_cache (DenoisingCacheConfig)
- in_dtype (DType)
- out_dtype (DType)
- enable_structured_output (bool)
- structured_output_backend (str)
- enable_variable_logits (bool)
- enable_penalties (bool)
- enable_min_tokens (bool)
- sample_on_host (bool)
- gpu_profiling (Literal['off', 'on', 'detailed'])
- profiling_enabled (bool)
- profiling_output_path (str | None)
- profiling_dynolog_enabled (bool)
- profiling_warmup_steps (Annotated[int, Ge(ge=0)])
- profiling_active_steps (Annotated[int, Ge(ge=1)])
- profiling_periodic_flush_seconds (Annotated[int, Ge(ge=1)])
- lora (LoRAConfig | None)
- speculative (SpeculativeConfig | None)
- draft_model (MAXModelConfig | None)
allow_extra_request_fieldsβ
allow_extra_request_fields: bool
allow_unsupported_logprobsβ
allow_unsupported_logprobs: bool
ce_delay_msβ
ce_delay_ms: float
chat_templateβ
chat_template: Path | None
config_fileβ
Path to the configuration file.
custom_architecturesβ
data_parallel_degreeβ
data_parallel_degree: int
debug_verify_replayβ
debug_verify_replay: bool
decode_request_ttl_sβ
decode_stall_timeout_sβ
denoising_cacheβ
denoising_cache: DenoisingCacheConfig
device_graph_captureβ
device_specsβ
device_specs: list[DeviceSpec]
draft_modelβ
draft_model: MAXModelConfig | None
emit_reasoning_contentβ
emit_reasoning_content: bool
enable_chunked_prefillβ
enable_chunked_prefill: bool
enable_echoβ
enable_echo: bool
enable_in_flight_batchingβ
enable_in_flight_batching: bool
enable_min_tokensβ
enable_min_tokens: bool
enable_overlap_schedulerβ
enable_overlap_scheduler: bool
enable_penaltiesβ
enable_penalties: bool
enable_prioritize_first_decodeβ
enable_prioritize_first_decode: bool
enable_structured_outputβ
enable_structured_output: bool
enable_variable_logitsβ
enable_variable_logits: bool
ep_sizeβ
ep_size: int
ep_use_allreduceβ
ep_use_allreduce: bool
eplb_profileβ
eplb_profile: bool
eplb_replicas_per_gpuβ
eplb_replicas_per_gpu: int
execute_empty_batchesβ
execute_empty_batches: bool
forceβ
force: bool
force_downloadβ
force_download: bool
from_flat_kwargs()β
classmethod from_flat_kwargs(**kwargs)
Construct a PipelineArgs from a flat CLI kwargs namespace.
Routes flat kwargs (the same format accepted by
PipelineConfig.from_flat_kwargs()) into the appropriate flat
fields of PipelineArgs. Delegates to
PipelineConfig.from_flat_kwargs() for the heavy-lifting of
routing and sub-config construction, then extracts the user-facing
fields.
-
Parameters:
-
**kwargs (Any) β Flat keyword arguments, e.g.
model_path,kv_cache_size,enable_lora. -
Returns:
-
A
PipelineArgspopulated from the flat kwargs. -
Return type:
from_pipeline_config()β
classmethod from_pipeline_config(pipeline_config)
Construct a PipelineArgs from an existing PipelineConfig.
Extracts the user-facing flat fields from a PipelineConfig
and returns a PipelineArgs populated from them.
This exists to let from_flat_kwargs() reuse
PipelineConfig.from_flat_kwargs()βs flat-kwarg routing logic
(parsing --model-override, building the draft model config,
etc.) instead of duplicating it. It is not a general round-trip:
pipeline_config is expected to be freshly constructed and not
yet resolved. Resolution-derived state (e.g. an applied dtype cast
recorded by MAXModelConfig.resolve()) is not preserved β
PipelineArgs is deliberately isolated from resolution
mutations (see #90128), so passing an already-resolved
pipeline_config here will silently drop that state.
-
Parameters:
-
pipeline_config (PipelineConfig) β The source
PipelineConfigto extract from. Should not have hadPipelineConfig.resolve()called on it. -
Returns:
-
A
PipelineArgspopulated from the given config. -
Return type:
-
Self
gpu_profilingβ
gpu_profiling: GPUProfilingMode
huggingface_model_revisionβ
huggingface_model_revision: str
huggingface_weight_revisionβ
huggingface_weight_revision: str
in_dtypeβ
in_dtype: DType
kv_cacheβ
kv_cache: KVCacheConfig
kvcache_ce_watermarkβ
kvcache_ce_watermark: float
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_batch_input_tokensβ
max_batch_input_tokens: int
max_batch_sizeβ
max_batch_total_tokensβ
max_lengthβ
max_num_stepsβ
max_num_steps: int
max_queue_size_tgβ
max_vision_cache_entriesβ
max_vision_cache_entries: int
min_batch_size_tgβ
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
out_dtypeβ
out_dtype: DType
pipeline_roleβ
pipeline_role: PipelineRole
pool_embeddingsβ
pool_embeddings: bool
prefer_module_v3β
prefer_module_v3: bool
profiling_active_stepsβ
profiling_active_steps: int
profiling_dynolog_enabledβ
profiling_dynolog_enabled: bool
profiling_enabledβ
profiling_enabled: bool
profiling_output_pathβ
profiling_periodic_flush_secondsβ
profiling_periodic_flush_seconds: int
profiling_warmup_stepsβ
profiling_warmup_steps: int
quantization_encodingβ
quantization_encoding: SupportedEncoding | None
reasoning_parserβ
rope_typeβ
sample_on_hostβ
sample_on_host: bool
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
structured_output_backendβ
structured_output_backend: str
subfolderβ
taskβ
task: PipelineTask
temperatureβ
thinking_temperatureβ
tool_parserβ
trust_remote_codeβ
trust_remote_code: bool
use_experimental_kernelsβ
use_experimental_kernels: str
use_subgraphsβ
use_subgraphs: bool
use_vendor_blasβ
use_vendor_blas: str
use_vendor_cclβ
use_vendor_ccl: str
vision_config_overridesβ
weight_pathβ
weight_path: list[Path]
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!