Skip to content

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:

HashableDict

Bases: dict

A dictionary that can be hashed by lru_cache.

HashableList

Bases: list

A list that can be hashed by lru_cache.

_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.

_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.

_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.

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.

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.

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.

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.

processor_has_attr(processor_name, model_type, attr, *, revision=None, trust_remote_code=False)

Remote code processors can only be checked by loading them.