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

ArchConfigWithVisionCache

ArchConfigWithVisionCache

class max.pipelines.lib.interfaces.ArchConfigWithVisionCache(*args, **kwargs)

source

Bases: Protocol

Config for a vision-language architecture with a vision encoder cache.

Both hooks are architecture facts derived purely from the HuggingFace config — classmethods, so config construction and memory planning can consult them without building an arch config instance. Architectures without a vision cache simply do not implement this protocol; consumers gate on issubclass. Deliberately standalone (not an ArchConfig refinement) so that gate checks exactly these two hooks.

estimate_vision_cache_entry_bytes()

classmethod estimate_vision_cache_entry_bytes(huggingface_config)

source

Worst-case bytes for one vision encoder cache entry.

The memory a single max-resolution image (or video, for video models) occupies after the vision encoder’s spatial merge / patch merge step. 0 means the checkpoint has no vision cache.

Parameters:

huggingface_config (AutoConfig)

Return type:

int

get_vision_cache_row_spec()

classmethod get_vision_cache_row_spec(huggingface_config)

source

Describes one merged vision token’s embedding row in the cache.

Returns (hidden_size, dtype) for architectures that opt into the block-mode vision cache, or None when the checkpoint has no vision cache.

Parameters:

huggingface_config (AutoConfig)

Return type:

tuple[int, DType] | None