[OpenVINO] Add image-text-to-embedding task for Qwen2VL#1649
Open
jianxiah-intel wants to merge 2 commits intohuggingface:mainfrom
Open
[OpenVINO] Add image-text-to-embedding task for Qwen2VL#1649jianxiah-intel wants to merge 2 commits intohuggingface:mainfrom
jianxiah-intel wants to merge 2 commits intohuggingface:mainfrom
Conversation
Add a new task type that runs the full Qwen2VL (for now) multimodal pipeline through a stateless language model backbone (no lm_head, no KV-cache) and returns raw last_hidden_state [B, T, D].
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
This PR adds
image-text-to-embeddingtask support for Qwen2VL-based models in the OpenVINO exporter.Qwen2VLEmbeddingPatcherto patch the model forward for export, replacing the full causal LM forward with a backbone-only call that outputs last_hidden_state.LMEmbeddingConfigHelperand registered theimage-text-to-embeddingtask in the tasks manager for qwen2_vl.OVModelForImageTextToEmbeddingas the inference class, along withOVLMEmbeddingModel(stateless LM submodel without KV-cache) and_OVQwen2VLForEmbedding.MODEL_TYPE_TO_IMAGE_TEXT_TO_EMBEDDING_CLS_MAPPINGas a dedicated dispatch table for the new task, parallel to the existing MODEL_TYPE_TO_CLS_MAPPING.Support for additional architectures (e.g., Qwen3VL Embedding) will be added in follow-up PRs.
Before submitting