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.
Source code in vllm/multimodal/hasher.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 | |
iter_item_to_bytes(key, obj)
classmethod
¶
Yield the digest input for a single key/obj pair.
Source code in vllm/multimodal/hasher.py
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).
Source code in vllm/multimodal/hasher.py
_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