Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions invokeai/app/invocations/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down