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
PipelinedModel
PipelinedModel
class max.pipelines.lib.pipeline_parallel.PipelinedModel(pipeline_config, session, devices, kv_cache_config, weights, adapter, return_logits, *, memory_plan, return_hidden_states=ReturnHiddenStates.NONE, max_batch_size=1)
Bases: PipelineModel[BaseContextType, Any, Any]
Mixin for a pipeline model whose decoder can run as pipeline stages.
Its graph builds through stage_graph(), or traces or compiles on
stage_input_types(), and outputs what stage_outputs()
returns, for the stage its config carries. Every
stage’s graph takes the whole model’s graph inputs, so the engine that
serves the stages prepares each stage’s inputs as it would the whole
model’s. A stage after the first takes what the previous stage’s
decoder returned after them.
-
Parameters:
-
- pipeline_config (PipelineConfig)
- session (InferenceSession)
- devices (list[Device])
- kv_cache_config (KVCacheConfig)
- weights (Weights)
- adapter (WeightsAdapter | None)
- return_logits (ReturnLogits)
- memory_plan (MemoryPlan)
- return_hidden_states (ReturnHiddenStates)
- max_batch_size (int)
stage_speculation_error()
classmethod stage_speculation_error(pipeline_config)
Returns why this model can’t build a speculating last stage.
Returns None if it can under pipeline_config. A model that
speculates only inherits a stage’s layers from its target, so it
refuses unless it overrides this. An exporter asks before anything
loads.
-
Parameters:
-
pipeline_config (PipelineConfig)
-
Return type:
-
str | None