vllm.model_executor.models.clip
¶
Classes:
-
CLIPAttention– -
CLIPEncoder–Transformer encoder consisting of
config.num_hidden_layersself -
CLIPImagePixelInputs–Dimensions:
Functions:
-
dual_encoder_has_text_tokens–Whether a dual-encoder pooling batch still contains text tokens.
-
merge_dual_encoder_text_and_vision–Restore vision embeddings on multimodal tokens after the text encoder.
CLIPAttention
¶
CLIPEncoder
¶
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.