Skip to content

Commit 028a965

Browse files
committed
warning for true cfg and guidance scale
1 parent 720519d commit 028a965

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/diffusers/pipelines/hunyuan_video/pipeline_hunyuan_video_image2video.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -441,6 +441,8 @@ def check_inputs(
441441
prompt_embeds=None,
442442
callback_on_step_end_tensor_inputs=None,
443443
prompt_template=None,
444+
true_cfg_scale=1.0,
445+
guidance_scale=1.0,
444446
):
445447
if height % 16 != 0 or width % 16 != 0:
446448
raise ValueError(f"`height` and `width` have to be divisible by 16 but are {height} and {width}.")
@@ -479,6 +481,13 @@ def check_inputs(
479481
f"`prompt_template` has to contain a key `template` but only found {prompt_template.keys()}"
480482
)
481483

484+
if true_cfg_scale > 1.0 and guidance_scale > 1.0:
485+
logger.warning(
486+
"Both `true_cfg_scale` and `guidance_scale` are greater than 1.0. This will result in both "
487+
"classifier-free guidance and embedded-guidance to be applied. This is not recommended "
488+
"as it may lead to higher memory usage, slower inference and potentially worse results."
489+
)
490+
482491
def prepare_latents(
483492
self,
484493
image: torch.Tensor,
@@ -718,6 +727,8 @@ def __call__(
718727
prompt_embeds,
719728
callback_on_step_end_tensor_inputs,
720729
prompt_template,
730+
true_cfg_scale,
731+
guidance_scale,
721732
)
722733

723734
image_condition_type = self.transformer.config.image_condition_type

0 commit comments

Comments
 (0)