vllm.multimodal.hasher
¶
Classes:
-
MultiModalHasher–Derives multi-modal cache keys.
MultiModalHasher
¶
Derives multi-modal cache keys.
Every method here yields framed chunks: each chunk is preceded by its length and each container by its kind, so that the concatenation fed to the digest is uniquely decodable and distinct inputs cannot share a key.
Methods:
-
iter_item_to_bytes–Yield the digest input for a single
key/objpair. -
iter_value_to_bytes–Yield the digest input for a value, tagged by its container kind.
iter_item_to_bytes(key, obj)
classmethod
¶
Yield the digest input for a single key/obj pair.
iter_value_to_bytes(obj)
classmethod
¶
Yield the digest input for a value, tagged by its container kind.
Containers carry their kind and length so that a nested structure can never serialize to the same bytes as a differently shaped one (a list and a mapping keyed by stringified indices, for example).
_framed(chunk)
¶
Yield chunk preceded by its size in bytes.
_get_hasher_factory(algorithm)
cached
¶
Get the hasher factory based on the configured algorithm.
Parameters:
-
(algorithm¶MMHasherAlgorithm) –Hash algorithm name (blake3, sha256, or sha512)
Returns a callable that creates a new hasher instance. Supports blake3 (default), sha256, and sha512 for FIPS compliance.
See: https://github.com/vllm-project/vllm/issues/18334