[Bugfix] fix EVS for qwen3-vl (#44205)

Signed-off-by: Rui "Garry" Gao <garrygaogg@gmail.com>
Co-authored-by: Cyrus Leung <tlleungac@connect.ust.hk>
This commit is contained in:
Rui "Garry" Gao
2026-06-04 11:06:51 +00:00
committed by GitHub
co-authored by Cyrus Leung
parent 90619351e3
commit 4b87b3e845
+4 -4
View File
@@ -2269,6 +2269,8 @@ class Qwen3VLForConditionalGeneration(
input_embeds for the LLM. input_embeds for the LLM.
""" """
device = video_embeddings.device
# Generate video replacement token IDs using get_video_repl # Generate video replacement token IDs using get_video_repl
# This tokenizes each frame separator independently, then uses pre-tokenized # This tokenizes each frame separator independently, then uses pre-tokenized
# special tokens to ensure consistent tokenization regardless of # special tokens to ensure consistent tokenization regardless of
@@ -2283,10 +2285,8 @@ class Qwen3VLForConditionalGeneration(
select_token_id=self.is_multimodal_pruning_enabled, select_token_id=self.is_multimodal_pruning_enabled,
) )
repl_token_ids = torch.tensor(video_repl.full) repl_token_ids = torch.tensor(video_repl.full, device=device)
embed_token_id = _cached_tensor( embed_token_id = _cached_tensor(self.config.video_token_id, device=device)
self.config.video_token_id, repl_token_ids.device
)
is_video_embed = torch.isin(repl_token_ids, embed_token_id) is_video_embed = torch.isin(repl_token_ids, embed_token_id)
# Get text embeddings for indicator tokens (has only `visual_dim``). # Get text embeddings for indicator tokens (has only `visual_dim``).