[MM][CG][BugFix] Fix Ernie-4.5-VL encoder CG postprocess for multi-path outputs (#51461)

Signed-off-by: qyYue1389 <yueqiuyang1389@gmail.com>

Qiuyang Yue committed Aug 10, 2026 at 17:39 UTC b2506d62aec7e6bccc5959b829221a7ae217abf3
1 file changed +3 -1
vllm/model_executor/models/ernie45_vl.py
+3 -1
@@ -1721,7 +1721,7 @@ class Ernie4_5_VLMoeForConditionalGeneration(
1721
1722 def postprocess_encoder_output(
1723 self,
1724 - output: torch.Tensor,
1724 + outputs: dict[str, torch.Tensor],
1725 indices: list[int],
1726 per_item_out_tokens: list[int],
1727 dest,
@@ -1731,6 +1731,8 @@ class Ernie4_5_VLMoeForConditionalGeneration(
1731 # The graph output is the raw ViT features (pre-merge), padded to the
1732 # token budget. Run the resampler eagerly on the valid portion using
1733 # the actual batch grid_thw, then scatter the post-merge embeddings.
1734 + # Ernie only uses the single "default" encoder path.
1735 + output = outputs["default"]
1736 grid_thw = batch_mm_kwargs["image_grid_thw"].to(output.device)
1737 num_valid = int((grid_thw[:, 0] * grid_thw[:, 1] * grid_thw[:, 2]).sum())
1738 image_embeds = self.resampler_model(output[:num_valid], grid_thw)