[Bugfix] Fix config misalignment between offline and online diffusion inference (Wan2.2, Qwen-Image series) (#1979)

Signed-off-by: samithuang <285365963@qq.com>
Signed-off-by: Samit <285365963@qq.com>
Co-authored-by: Hongsheng Liu <liuhongsheng4@huawei.com>
This commit is contained in:
SamitandHongsheng Liu authored and GitHub committed 2026-03-19 16:00:26 +08:00
1 parent 81793f1918
commit 5699fe7a96
6 files changed
+40 -22

No files matched your search

+13 -7
View File
@@ -28,17 +28,23 @@ class OmniDiffusionRequest:
def __post_init__(self):
"""Initialize dependent fields after dataclass initialization."""
# Detect whether user explicitly provided guidance_scale.
# The sentinel default is 0.0 (false-like); any truthy value means
# the caller set it intentionally. We must resolve this BEFORE
# auto-filling guidance_scale_2, otherwise the sentinel leaks into
# guidance_scale_2.
if self.sampling_params.guidance_scale:
self.sampling_params.guidance_scale_provided = True
else:
self.sampling_params.guidance_scale = 1.0
# Set do_classifier_free_guidance based on guidance scale and negative prompt
if self.sampling_params.guidance_scale > 1.0 and any(
(not isinstance(p, str) and p.get("negative_prompt")) for p in self.prompts
):
self.sampling_params.do_classifier_free_guidance = True
# Auto-fill guidance_scale_2 from the (now-resolved) guidance_scale
# so downstream code always has a valid value.
if self.sampling_params.guidance_scale_2 is None:
self.sampling_params.guidance_scale_2 = self.sampling_params.guidance_scale
# The dataclass default value is 0 (false-like), used to detect whether user explicitly provides this value
# After this check is done, reset this value to old default 1
if self.sampling_params.guidance_scale:
self.sampling_params.guidance_scale_provided = True
else:
self.sampling_params.guidance_scale = 1.0