[Feature] HunyuanImage-3.0 IT2I (image editing) support (#3107)
Signed-off-by: TaffyOfficial <2324465096@qq.com> Signed-off-by: zuiho <2324465096@qq.com> Signed-off-by: skf1999 <13234016272@163.com> Co-authored-by: TaffyOfficial <2324465096@qq.com> Co-authored-by: dengyunyang <584797741@qq.com> Co-authored-by: John Liu BUAA <liukecheng97@gmail.com>
This commit is contained in:
8 files changed
+573
-28
No files matched your search
@@ -36,7 +36,7 @@ stage_args:
|
||||
top_k: 1024
|
||||
max_tokens: 4096
|
||||
stop_token_ids: [127957] # <|endoftext|>
|
||||
detokenize: false
|
||||
detokenize: true # DiT bridge consumes ar_generated_text; let the AR engine produce it
|
||||
|
||||
# Stage 1: Diffusion (DiT + VAE)
|
||||
# Receives latents from AR stage, performs denoising + VAE decode
|
||||
@@ -56,8 +56,6 @@ stage_args:
|
||||
parallel_config:
|
||||
tensor_parallel_size: 4
|
||||
enable_expert_parallel: true
|
||||
omni_kv_config:
|
||||
need_recv_cache: true
|
||||
engine_input_source: [0] # Input from AR stage
|
||||
custom_process_input_func: vllm_omni.model_executor.stage_input_processors.hunyuan_image3.ar2diffusion
|
||||
final_output: true
|
||||
|
||||
@@ -10,6 +10,8 @@ The ar2diffusion function bridges these two stages, following the same
|
||||
signature pattern as glm_image.ar2diffusion.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
from typing import Any
|
||||
|
||||
import torch
|
||||
@@ -61,6 +63,7 @@ def ar2diffusion(
|
||||
height = original_prompt.get("height", 1024)
|
||||
width = original_prompt.get("width", 1024)
|
||||
text_prompt = original_prompt.get("prompt", "")
|
||||
use_system_prompt = original_prompt.get("use_system_prompt")
|
||||
|
||||
logger.info(
|
||||
"[ar2diffusion] Request %d: AR generated %d tokens, text length=%d, target size=%dx%d",
|
||||
@@ -83,16 +86,20 @@ def ar2diffusion(
|
||||
},
|
||||
}
|
||||
|
||||
# Forward multimodal data (original image for IT2I conditioning)
|
||||
# Forward use_system_prompt so the DiT can build the same system prefix
|
||||
if use_system_prompt is not None:
|
||||
diffusion_input["use_system_prompt"] = use_system_prompt
|
||||
|
||||
# Forward multimodal data (original image for IT2I conditioning).
|
||||
# The diffusion pre_process_func reads multi_modal_data["image"], which
|
||||
# matches vLLM's standard prompt schema, so we only need to pass it once.
|
||||
mm_data = original_prompt.get("multi_modal_data")
|
||||
if mm_data:
|
||||
pil_image = mm_data.get("image")
|
||||
if pil_image is None:
|
||||
images = mm_data.get("images")
|
||||
if images:
|
||||
pil_image = images[0] if isinstance(images, list) else images
|
||||
if pil_image is not None:
|
||||
diffusion_input["pil_image"] = pil_image
|
||||
prompt_images = mm_data.get("image")
|
||||
if prompt_images is None:
|
||||
prompt_images = mm_data.get("images")
|
||||
if prompt_images is not None:
|
||||
diffusion_input["multi_modal_data"] = {"image": prompt_images}
|
||||
|
||||
# Forward multimodal output from AR (if any)
|
||||
if hasattr(ar_output, "multimodal_output") and ar_output.multimodal_output:
|
||||
|
||||
Reference in new issue
Block a user