diff --git a/vllm/model_executor/models/qwen3_vl.py b/vllm/model_executor/models/qwen3_vl.py index 28c62e59bd1..9b8c42713f8 100644 --- a/vllm/model_executor/models/qwen3_vl.py +++ b/vllm/model_executor/models/qwen3_vl.py @@ -2269,6 +2269,8 @@ class Qwen3VLForConditionalGeneration( input_embeds for the LLM. """ + device = video_embeddings.device + # Generate video replacement token IDs using get_video_repl # This tokenizes each frame separator independently, then uses pre-tokenized # special tokens to ensure consistent tokenization regardless of @@ -2283,10 +2285,8 @@ class Qwen3VLForConditionalGeneration( select_token_id=self.is_multimodal_pruning_enabled, ) - repl_token_ids = torch.tensor(video_repl.full) - embed_token_id = _cached_tensor( - self.config.video_token_id, repl_token_ids.device - ) + repl_token_ids = torch.tensor(video_repl.full, device=device) + embed_token_id = _cached_tensor(self.config.video_token_id, device=device) is_video_embed = torch.isin(repl_token_ids, embed_token_id) # Get text embeddings for indicator tokens (has only `visual_dim``).