From 14879d6619df20307ad8ee277ddf33a2c6efc33c Mon Sep 17 00:00:00 2001 From: dengyunyang <584797741@qq.com> Date: Thu, 11 Jun 2026 10:39:00 +0800 Subject: [PATCH] [Bugfix][HunyuanImage] fix accuracy in stream mode (#4265) Signed-off-by: dengyunyang <584797741@qq.com> Co-authored-by: Hongsheng Liu --- vllm_omni/engine/output_processor.py | 4 ++++ .../model_executor/stage_input_processors/hunyuan_image3.py | 3 ++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/vllm_omni/engine/output_processor.py b/vllm_omni/engine/output_processor.py index 369fe3c7b..5c0b752b3 100644 --- a/vllm_omni/engine/output_processor.py +++ b/vllm_omni/engine/output_processor.py @@ -269,6 +269,10 @@ class OmniRequestState(RequestState): # tokens, so we always store a cumulative copy here. base_output.cumulative_token_ids = list(self.detokenizer.output_token_ids) + # Attach cumulative_text only at the final step for inter-stage use. + if finish_reason is not None and hasattr(self.detokenizer, "output_text"): + base_output.cumulative_text = self.detokenizer.output_text + if not hasattr(base_output, "multimodal_output"): setattr(base_output, "multimodal_output", {}) if self.mm_accumulated: diff --git a/vllm_omni/model_executor/stage_input_processors/hunyuan_image3.py b/vllm_omni/model_executor/stage_input_processors/hunyuan_image3.py index 749e213e0..365cf0641 100644 --- a/vllm_omni/model_executor/stage_input_processors/hunyuan_image3.py +++ b/vllm_omni/model_executor/stage_input_processors/hunyuan_image3.py @@ -185,7 +185,8 @@ def ar2diffusion( for i, ar_output in enumerate(ar_outputs): output = ar_output.outputs[0] generated_token_ids = output.cumulative_token_ids - generated_text = getattr(output, "text", "") or "" + # Prefer cumulative_text, fallback to text if aggregation dropped it + generated_text = getattr(output, "cumulative_text", None) or getattr(output, "text", "") or "" # Get original prompt info original_prompt = prompt[i] if i < len(prompt) else {}