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

PreprocessCacheStatsProbe

PreprocessCacheStatsProbe​

class max.pipelines.modeling.types.PreprocessCacheStatsProbe(*args, **kwargs)

source

Bases: Protocol

Optional tokenizer capability: report its media preprocess caches.

An architecture that caches preprocessed media implements this so the server can publish the cache’s occupancy and eviction pressure, which is what separates “this workload has no repeats” from “the cache is thrashing at its budget” – readings a hit rate alone cannot tell apart.

A separate protocol rather than a defaulted method on PipelineTokenizer, for the same reason as PreprocessedImageProbe: PipelineTokenizer is runtime_checkable and the API server gates request admission on isinstance against it, so a new member there would reject every tokenizer that does not define it. This also keeps the absence typed rather than a getattr sniff at a private attribute name, which would stop working silently the day an architecture renames its cache.

preprocess_cache_stats()​

preprocess_cache_stats()

source

This tokenizer’s preprocess caches, keyed by media kind.

Must not preprocess, evict or otherwise disturb a cache: the server calls it per request on the event loop.

Returns:

One entry per cache the tokenizer owns, keyed image or video. An architecture with no video cache simply omits that key rather than reporting an empty one.

Return type:

Mapping[str, VisionPreprocessCacheStats]