[MM] Keep raw pixels through dp-sharded ViT path (#56872)

Signed-off-by: cjackal <44624812+cjackal@users.noreply.github.com>

cjackal committed Sep 17, 2026 at 03:47 UTC 403f182c02778a447cf72cfd08b72537eeba72f8
3 files changed +7 -6
vllm/model_executor/models/qwen2_5_vl.py
+2 -2
@@ -1441,7 +1441,7 @@ class Qwen2_5_VLForConditionalGeneration(
1441 if self.use_data_parallel:
1442 return run_dp_sharded_mrope_vision_model(
1443 self.visual,
1444 - pixel_values.type(self.visual.dtype),
1444 + pixel_values,
1445 grid_thw_list,
1446 rope_type="rope_3d",
1447 )
@@ -1501,7 +1501,7 @@ class Qwen2_5_VLForConditionalGeneration(
1501 if self.use_data_parallel:
1502 return run_dp_sharded_mrope_vision_model(
1503 self.visual,
1504 - pixel_values_videos.type(self.visual.dtype),
1504 + pixel_values_videos,
1505 grid_thw_list,
1506 rope_type="rope_3d",
1507 )
vllm/model_executor/models/qwen2_vl.py
+2 -2
@@ -1379,7 +1379,7 @@ class Qwen2VLForConditionalGeneration(
1379 if self.use_data_parallel:
1380 return run_dp_sharded_mrope_vision_model(
1381 self.visual,
1382 - pixel_values.type(self.visual.dtype),
1382 + pixel_values,
1383 grid_thw.tolist(),
1384 rope_type="rope_3d",
1385 )
@@ -1404,7 +1404,7 @@ class Qwen2VLForConditionalGeneration(
1404 if self.use_data_parallel:
1405 return run_dp_sharded_mrope_vision_model(
1406 self.visual,
1407 - pixel_values_videos.type(self.visual.dtype),
1407 + pixel_values_videos,
1408 grid_thw.tolist(),
1409 rope_type="rope_3d",
1410 )
vllm/model_executor/models/vision.py
+3 -2
@@ -481,6 +481,7 @@ def run_dp_sharded_mrope_vision_model(
481 # to work
482 max_len_per_rank = max(grouped_pixel_values_len) // embed_dim_reduction_factor
483 local_grid_thw_list = [grid_thw_list[i] for i in image_idxs_local]
484 + embed_dtype = next(vision_model.parameters()).dtype
485
486 # Run the vision model on the local pixel_values_local
487 if rope_type == "rope_2d":
@@ -495,7 +496,7 @@ def run_dp_sharded_mrope_vision_model(
496 image_embeds_local = torch.empty(
497 (0, embed_dim_reduction_factor, out_dim),
498 device=pixel_values.device,
498 - dtype=pixel_values.dtype,
499 + dtype=embed_dtype,
500 )
501 else:
502 if pixel_values_local.shape[0] > 0:
@@ -505,7 +506,7 @@ def run_dp_sharded_mrope_vision_model(
506 image_embeds_local = torch.empty(
507 (0, vision_model.out_hidden_size),
508 device=pixel_values.device,
508 - dtype=pixel_values.dtype,
509 + dtype=embed_dtype,
510 )
511
512 # Pad the output based on max_len_per_rank