vllm.transformers_utils.processor
¶
Classes:
-
HashableDict–A dictionary that can be hashed by lru_cache.
-
HashableList–A list that can be hashed by lru_cache.
Functions:
-
get_feature_extractor–Load an audio feature extractor for the given model name
-
get_image_processor–Load an image processor for the given model name via HuggingFace.
-
get_processor–Load a processor for the given model name via HuggingFace.
-
get_video_processor–Load a video processor for the given model name via HuggingFace.
-
processor_has_attr–Remote code processors can only be checked by loading them.
HashableDict
¶
Bases: dict
A dictionary that can be hashed by lru_cache.
Source code in vllm/transformers_utils/processor.py
HashableList
¶
_remote_code_kwargs_not_total()
¶
Some remote code processors define their kwargs TypedDicts without
total=False, which makes every kwarg required when Transformers validates
them. For backward compatibility, we mark these kwargs as optional as soon as
the remote code is imported, before any processor is constructed.
Source code in vllm/transformers_utils/processor.py
_transformers_v4_compatibility_import()
¶
Some remote code processors still import ChatTemplateLoadKwargs which was a
subset of ProcessorChatTemplateKwargs as defined in Transformers v4.
In Transformers v5 these were merged into ProcessorChatTemplateKwargs and
ChatTemplateLoadKwargs was removed. For backward compatibility, we add an alias
for ChatTemplateLoadKwargs if it doesn't exist.
Source code in vllm/transformers_utils/processor.py
_transformers_v4_compatibility_init()
¶
Some remote code processors may define optional_attributes in their
ProcessorMixin subclass, and then pass these arbitrary attributes directly to
ProcessorMixin.__init__, which is no longer allowed in Transformers v5. For
backward compatibility, we intercept these optional attributes and set them on the
processor instance before calling the original ProcessorMixin.__init__.
This can be removed if Molmo2ForConditionalGeneration is upstreamed to
Transformers.
Source code in vllm/transformers_utils/processor.py
get_feature_extractor(processor_name, *args, revision=None, trust_remote_code=False, **kwargs)
¶
Load an audio feature extractor for the given model name via HuggingFace.
Source code in vllm/transformers_utils/processor.py
get_image_processor(processor_name, *args, revision=None, trust_remote_code=False, processor_cls_overrides=None, **kwargs)
¶
Load an image processor for the given model name via HuggingFace.
Source code in vllm/transformers_utils/processor.py
get_processor(processor_name, *args, revision=None, trust_remote_code=False, processor_cls=ProcessorMixin, **kwargs)
¶
Load a processor for the given model name via HuggingFace.
Source code in vllm/transformers_utils/processor.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 | |
get_video_processor(processor_name, *args, revision=None, trust_remote_code=False, processor_cls_overrides=None, **kwargs)
¶
Load a video processor for the given model name via HuggingFace.
Source code in vllm/transformers_utils/processor.py
processor_has_attr(processor_name, model_type, attr, *, revision=None, trust_remote_code=False)
¶
Remote code processors can only be checked by loading them.