From b2506d62aec7e6bccc5959b829221a7ae217abf3 Mon Sep 17 00:00:00 2001 From: Qiuyang Yue Date: Mon, 10 Aug 2026 17:39:04 -0700 Subject: [PATCH] [MM][CG][BugFix] Fix Ernie-4.5-VL encoder CG postprocess for multi-path outputs (#51461) Signed-off-by: qyYue1389 --- vllm/model_executor/models/ernie45_vl.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/vllm/model_executor/models/ernie45_vl.py b/vllm/model_executor/models/ernie45_vl.py index 74de1a0e9f..f27e047b47 100644 --- a/vllm/model_executor/models/ernie45_vl.py +++ b/vllm/model_executor/models/ernie45_vl.py @@ -1721,7 +1721,7 @@ class Ernie4_5_VLMoeForConditionalGeneration( def postprocess_encoder_output( self, - output: torch.Tensor, + outputs: dict[str, torch.Tensor], indices: list[int], per_item_out_tokens: list[int], dest, @@ -1731,6 +1731,8 @@ class Ernie4_5_VLMoeForConditionalGeneration( # The graph output is the raw ViT features (pre-merge), padded to the # token budget. Run the resampler eagerly on the valid portion using # the actual batch grid_thw, then scatter the post-merge embeddings. + # Ernie only uses the single "default" encoder path. + output = outputs["default"] grid_thw = batch_mm_kwargs["image_grid_thw"].to(output.device) num_valid = int((grid_thw[:, 0] * grid_thw[:, 1] * grid_thw[:, 2]).sum()) image_embeds = self.resampler_model(output[:num_valid], grid_thw)