diffusion: Fix silent override of explicit guidance_scale=0 (#4999)
Signed-off-by: Harenome Ranaivoarivony-Razanajato <harenome.razanajato1@huawei.com>
This commit is contained in:
1 parent
0a03359224
commit
8cb79308c6
6 files changed
+48
-9
No files matched your search
@@ -640,7 +640,9 @@ class FluxKontextPipeline(
|
||||
width = req.sampling_params.width or width
|
||||
num_inference_steps = req.sampling_params.num_inference_steps or num_inference_steps
|
||||
sigmas = req.sampling_params.sigmas or sigmas
|
||||
guidance_scale = req.sampling_params.guidance_scale or guidance_scale
|
||||
guidance_scale = (
|
||||
req.sampling_params.guidance_scale if req.sampling_params.guidance_scale_provided else guidance_scale
|
||||
)
|
||||
num_images_per_prompt = (
|
||||
req.sampling_params.num_outputs_per_prompt
|
||||
if req.sampling_params.num_outputs_per_prompt > 0
|
||||
|
||||
@@ -733,7 +733,7 @@ class GlmImagePipeline(nn.Module, DiffusionPipelineProfilerMixin, SupportsCompon
|
||||
)
|
||||
width = ar_width or req.sampling_params.width or img_width or self.default_sample_size * self.vae_scale_factor
|
||||
num_inference_steps = req.sampling_params.num_inference_steps or 50
|
||||
guidance_scale = req.sampling_params.guidance_scale or 1.5
|
||||
guidance_scale = req.sampling_params.guidance_scale if req.sampling_params.guidance_scale_provided else 1.5
|
||||
|
||||
# Ensure dimensions are multiples of vae_scale_factor * patch_size
|
||||
multiple_of = self.vae_scale_factor * self._patch_size
|
||||
|
||||
@@ -353,7 +353,7 @@ class FlowMatchingAudioPipeline(
|
||||
sampling_params.extra_args = extra_args
|
||||
|
||||
num_inference_steps = sampling_params.num_inference_steps or 32
|
||||
guidance_scale = sampling_params.guidance_scale or 3.0
|
||||
guidance_scale = sampling_params.guidance_scale if sampling_params.guidance_scale_provided else 3.0
|
||||
generator = self._resolve_diffusion_generator(sampling_params)
|
||||
|
||||
with self._stage_timer("consume_payload"):
|
||||
|
||||
@@ -42,11 +42,11 @@ class OmniDiffusionRequest:
|
||||
self.sampling_params.seed = random.randint(0, 2**31 - 1)
|
||||
|
||||
# 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:
|
||||
# The unset sentinel is None (see OmniDiffusionSamplingParams); any value
|
||||
# the caller set -- including an explicit 0.0 (disable CFG) -- must be
|
||||
# honored. Resolve before auto-filling guidance_scale_2, else the sentinel
|
||||
# leaks into guidance_scale_2.
|
||||
if self.sampling_params.guidance_scale is not None:
|
||||
self.sampling_params.guidance_scale_provided = True
|
||||
else:
|
||||
self.sampling_params.guidance_scale = 1.0
|
||||
|
||||
Reference in new issue
Block a user