[Bugfix] Align the AR and DiT prompt formatting across both online and offline modes. (#3516)

Signed-off-by: dengyunyang <584797741@qq.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
dengyunyangandHongsheng Liu authored and GitHub committed 2026-05-12 12:13:30 +08:00
1 parent ce621be29b
commit 0d91fbbbb7
5 files changed
+49 -18

No files matched your search

+11 -5
View File
@@ -2255,26 +2255,32 @@ class OmniOpenAIServingChat(OpenAIServingChat, AudioMixin):
else:
engine_prompt_data = {"image": reference_images}
prompt_token_ids: list[int] | None = None
engine_prompt: OmniTextPrompt = {"prompt": prompt}
if bot_task:
from vllm_omni.diffusion.models.hunyuan_image3.prompt_utils import (
build_prompt,
build_prompt_tokens,
)
prompt_token_ids: list[int] | None = None
system_prompt_type: str | None = None
if tokenizer is not None:
prompt_token_ids = build_prompt_tokens(prompt, tokenizer, task=bot_task)
result = build_prompt_tokens(prompt, tokenizer, task=bot_task)
prompt_token_ids = result.token_ids
system_prompt_type = result.system_prompt_type
else:
prompt = build_prompt(prompt, task=bot_task)
engine_prompt["prompt"] = prompt
if reference_images and len(reference_images) == 1:
engine_prompt_data = {"image": reference_images[0]}
modalities = ["image"]
if prompt_token_ids is not None:
engine_prompt["prompt_token_ids"] = prompt_token_ids
if system_prompt_type is not None:
engine_prompt["use_system_prompt"] = system_prompt_type
engine_prompt: OmniTextPrompt = {"prompt": prompt}
engine_prompt["modalities"] = modalities
if prompt_token_ids is not None:
engine_prompt["prompt_token_ids"] = prompt_token_ids
if negative_prompt is not None:
engine_prompt["negative_prompt"] = negative_prompt