Skip to content

vllm.model_executor.models.clip

Classes:

Functions:

CLIPAttention

Bases: Module

Methods:

  • forward –

    Input shape: Batch x Time x Channel.

forward(hidden_states)

Input shape: Batch x Time x Channel.

CLIPEncoder

Bases: Module

Transformer encoder consisting of config.num_hidden_layers self attention layers. Each layer is a [CLIPEncoderLayer].

Parameters:

  • config

    (CLIPTextConfig | CLIPVisionConfig) –

    CLIPConfig

CLIPImagePixelInputs

Bases: TensorSchema

Dimensions: - bn: Batch size * number of images - c: Number of channels (3) - h: Height of each image - w: Width of each image

dual_encoder_has_text_tokens(has_mm_embeddings, is_multimodal)

Whether a dual-encoder pooling batch still contains text tokens.

embed_input_ids used to treat "the batch has any image embeddings" as "the whole batch is vision-only". Mixed image+text batches then skipped the text encoder, so completion-style text embeddings collapsed (issue

53091). Honor the per-token is_multimodal mask instead.

merge_dual_encoder_text_and_vision(text_features, vision_embeds, is_multimodal)

Restore vision embeddings on multimodal tokens after the text encoder.

The model runner builds is_multimodal on CPU; text and vision features are on the compute device.