diff --git a/invokeai/app/invocations/util.py b/invokeai/app/invocations/util.py index 3ae3e17ae67..6446d387414 100644 --- a/invokeai/app/invocations/util.py +++ b/invokeai/app/invocations/util.py @@ -3,9 +3,13 @@ def validate_weights(weights: Union[float, list[float]]) -> None: """Validate that all control weights in the valid range""" - to_validate = weights if isinstance(weights, list) else [weights] - if any(i < -1 or i > 2 for i in to_validate): - raise ValueError("Control weights must be within -1 to 2 range") + if isinstance(weights, list): + for i in weights: + if i < -1 or i > 2: + raise ValueError("Control weights must be within -1 to 2 range") + else: + if weights < -1 or weights > 2: + raise ValueError("Control weights must be within -1 to 2 range") def validate_begin_end_step(begin_step_percent: float, end_step_percent: float) -> None: