Filter ControlNet model based on active SD's version (#32)

This commit is contained in:
Chenlei Hu
2024-02-03 04:17:18 +00:00
committed by GitHub
parent 4f0152fed9
commit f2b1ee09d4

View File

@@ -98,12 +98,18 @@ def get_filtered_preprocessor_names(tag):
return list(get_filtered_preprocessors(tag).keys())
def get_filtered_controlnet_names(tag):
def get_filtered_controlnet_names(tag, filter_version: bool = True):
filtered_preprocessors = get_filtered_preprocessors(tag)
model_filename_filters = []
for p in filtered_preprocessors.values():
model_filename_filters += p.model_filename_filters
return [x for x in controlnet_names if any(f.lower() in x.lower() for f in model_filename_filters) or x == 'None']
return [
x for x in controlnet_names
if x == 'None' or (
any(f.lower() in x.lower() for f in model_filename_filters) and
get_sd_version().is_compatible_with(StableDiffusionVersion.detect_from_model_name(x))
)
]
def update_controlnet_filenames():