[Feature] HunyuanImage3 allow guidance_scale<=1 in DiT stage#2762
Conversation
b0b20e2 to
9108826
Compare
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
|
@gcanlin @Bounty-hunter PTAL |
a8ab210 to
178f23c
Compare
|
Why do we think that hunyuan-image doesn't support guidance_scale <= 1 before? |
In line 1013 of vllm_omni/diffusion/models/hunyuan_image_3/pipeline_hunyuan_image_3.py, if guidance_scale <= 1, it will be set to 1.0 + np.finfo(float).eps |
| @@ -544,7 +543,7 @@ def prepare_model_inputs( | |||
| generator = [torch.Generator(self.device).manual_seed(seed) for seed in seeds] | |||
|
|
|||
| # 3. apply chat template | |||
| cfg_factor = {"gen_text": 1, "gen_image": 2} | |||
| cfg_factor = {"gen_text": 1, "gen_image": 1 + int(guidance_scale > 1.0)} | |||
There was a problem hiding this comment.
Is this line equivalent to the official line below?
https://github.com/Tencent-Hunyuan/HunyuanImage-3.0/blob/d280425cf453a153e5846c725af58de39c10b09f/hunyuan_image_3/hunyuan_image_3_pipeline.py#L776
178f23c to
90f3077
Compare
Signed-off-by: KexiongYu <yukexiong1@huawei.com>
Signed-off-by: KexiongYu <yukexiong1@huawei.com>
Signed-off-by: KexiongYu <yukexiong1@huawei.com>
90f3077 to
d2091f9
Compare
…oject#2762) Signed-off-by: KexiongYu <yukexiong1@huawei.com>
…oject#2762) Signed-off-by: KexiongYu <yukexiong1@huawei.com>
Purpose
This PR is intended to adjust HunyuanImage3's default behavior that always generated the negative/unconditional branch, so generation can run in single-branch mode when guidance is not enabled.
What This PR Changes
Guidance behavior
guidance_scale <= 1.0without forcing it to1.0 + epsilon.CFG factor control
cfg_factorforgen_imagefrom a fixed value to dynamic gatingTensor layout robustness
view(...)withreshape(...)in the HunyuanImage3 attention output path to avoid runtime errors when tensors are non-contiguous.Test Plan
Tested on 4x Ascend NPU with v0.18.0.post1 vllm omni
Online
client
test plan without vllm omni
Test Result
guidance scale = 1.0 with vllm omni

guidance scale = 1.0 without vllm omni
