Skip to content

Commit

Permalink
Fix control type in preset (#2179)
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei authored Oct 15, 2023
1 parent df0788b commit a43e574
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/controlnet_ui/preset.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,17 @@ def load_presets(preset_dir: str) -> Dict[str, str]:


def infer_control_type(module: str, model: str) -> str:
def matches_control_type(input_string: str, control_type: str) -> bool:
return any(t.lower() in input_string for t in control_type.split("/"))

control_types = preprocessor_filters.keys()
control_type_candidates = [
control_type
for control_type in control_types
if control_type.lower() in module or control_type.lower() in model
if (
matches_control_type(module, control_type)
or matches_control_type(model, control_type)
)
]
if len(control_type_candidates) != 1:
raise ValueError(
Expand Down

0 comments on commit a43e574

Please sign in to comment.