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

MultiGraphPipelineModelWithKVCache

MultiGraphPipelineModelWithKVCache​

class max.pipelines.lib.MultiGraphPipelineModelWithKVCache(pipeline_config, session, devices, kv_cache_config, weights, adapter, return_logits, *, memory_plan, return_hidden_states=ReturnHiddenStates.NONE, max_batch_size=1)

source

Bases: PipelineModelWithKVCache[BaseContextType, _ModelConfigT, Model | None]

Graph-API VLM with unified load_model() and per-tower hooks.

_create_model_config() should return the full VLM config (with .vision_config and .text_config / .llm_config subconfigs) and assign model_config. Both _build_*() hooks receive that same model_config.

Override load_model() when graph capture or weight loading does not fit this flow (such as Qwen2.5VL, Kimi-K2.5).

Parameters:

load_model()​

load_model(session)

source

Build, compile, and load vision and language graphs into session.

Parameters:

session (InferenceSession)

Return type:

tuple[Model | None, Model]