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 function

cache_dtype_for_encoding

cache_dtype_for_encoding()​

max.pipelines.kv_cache.cache_dtype_for_encoding(quantization_encoding, kv_cache_format)

source

Returns the KV-cache dtype for a quantization encoding.

An explicit kv_cache_format override takes precedence; otherwise the dtype is derived from quantization_encoding (float32 when unset).

Parameters:

  • quantization_encoding (SupportedEncoding | None) – The resolved weight encoding, or None.
  • kv_cache_format (str | None) – An explicit override string, or None.

Returns:

The KV-cache DType.

Raises:

ValueError – If the override string or encoding is unrecognized.

Return type:

DType