From 463729ecdcdb35494c7ed7e1e6a807508e77f714 Mon Sep 17 00:00:00 2001 From: Jiazhi Mi Date: Fri, 24 Jul 2026 15:38:39 +0800 Subject: [PATCH] Fix duplicate HunyuanVL image boundary tokens Match the full image start/token/end placeholder during prompt replacement and align dummy inputs with the same format. --- vllm/model_executor/models/hunyuan_vision.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/vllm/model_executor/models/hunyuan_vision.py b/vllm/model_executor/models/hunyuan_vision.py index b980e8ae46a7..fc05b17d3baa 100644 --- a/vllm/model_executor/models/hunyuan_vision.py +++ b/vllm/model_executor/models/hunyuan_vision.py @@ -698,9 +698,12 @@ def get_dummy_text(self, mm_counts: Mapping[str, int]) -> str: num_images = mm_counts.get("image", 0) hf_processor = self.info.get_hf_processor(typ=HunYuanVLProcessor) - image_token: str = hf_processor.image_token + image_placeholder = ( + f"{hf_processor.image_start_token}{hf_processor.image_token}" + f"{hf_processor.image_end_token}" + ) - return image_token * num_images + return image_placeholder * num_images def get_dummy_mm_data( self, @@ -779,7 +782,11 @@ def get_replacement_hunyuan_vl(item_idx: int, modality: str): return [ PromptReplacement( modality=modality, - target=[token_ids[modality]], + target=[ + token_ids[f"{modality}_start"], + token_ids[modality], + token_ids[f"{modality}_end"], + ], replacement=partial(get_replacement_hunyuan_vl, modality=modality), ) for modality in ("image",)