Skip to content

Commit 87b800e

Browse files
authored
[modular diffusers] Fix AutoGuidance validation (#12247)
fix
1 parent e58711e commit 87b800e

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

src/diffusers/guiders/auto_guidance.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,15 +82,15 @@ def __init__(
8282
self.guidance_rescale = guidance_rescale
8383
self.use_original_formulation = use_original_formulation
8484

85-
if auto_guidance_layers is None and auto_guidance_config is None:
85+
is_layer_or_config_provided = auto_guidance_layers is not None or auto_guidance_config is not None
86+
is_layer_and_config_provided = auto_guidance_layers is not None and auto_guidance_config is not None
87+
if not is_layer_or_config_provided:
8688
raise ValueError(
87-
"Either `auto_guidance_layers` or `auto_guidance_config` must be provided to enable Skip Layer Guidance."
89+
"Either `auto_guidance_layers` or `auto_guidance_config` must be provided to enable AutoGuidance."
8890
)
89-
if auto_guidance_layers is not None and auto_guidance_config is not None:
91+
if is_layer_and_config_provided:
9092
raise ValueError("Only one of `auto_guidance_layers` or `auto_guidance_config` can be provided.")
91-
if (dropout is None and auto_guidance_layers is not None) or (
92-
dropout is not None and auto_guidance_layers is None
93-
):
93+
if auto_guidance_config is None and dropout is None:
9494
raise ValueError("`dropout` must be provided if `auto_guidance_layers` is provided.")
9595

9696
if auto_guidance_layers is not None:

0 commit comments

Comments
 (0)