From ee12d114c188b1a189374e1a29c391a702ca5d4a Mon Sep 17 00:00:00 2001 From: Manuel Schmid Date: Wed, 7 Aug 2024 16:42:05 +0200 Subject: [PATCH 1/2] fix: add handling for default "None" value of default_ip_image_* --- modules/config.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/modules/config.py b/modules/config.py index 001cf949d..51c247fb4 100644 --- a/modules/config.py +++ b/modules/config.py @@ -520,10 +520,14 @@ def init_temp_path(path: str | None, default_path: str) -> str: image_count += 1 default_ip_images[image_count] = get_config_item_or_set_default( key=f'default_ip_image_{image_count}', - default_value=None, - validator=lambda x: x is None or isinstance(x, str) and os.path.exists(x), + default_value='None', + validator=lambda x: x == 'None' or isinstance(x, str) and os.path.exists(x), expected_type=str ) + + if default_ip_images[image_count] == 'None': + default_ip_images[image_count] = None + default_ip_types[image_count] = get_config_item_or_set_default( key=f'default_ip_type_{image_count}', default_value=modules.flags.default_ip, From 8bd9ea1dbff23d74ed3dbfcd5dc8023dfc843d81 Mon Sep 17 00:00:00 2001 From: Manuel Schmid Date: Thu, 8 Aug 2024 13:13:06 +0200 Subject: [PATCH 2/2] fix: correctly validate default_inpaint_mask_sam_model --- modules/config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/modules/config.py b/modules/config.py index 51c247fb4..8609b4154 100644 --- a/modules/config.py +++ b/modules/config.py @@ -702,7 +702,7 @@ def init_temp_path(path: str | None, default_path: str) -> str: default_inpaint_mask_sam_model = get_config_item_or_set_default( key='default_inpaint_mask_sam_model', default_value='vit_b', - validator=lambda x: x in [y[1] for y in modules.flags.inpaint_mask_sam_model if y[1] == x], + validator=lambda x: x in modules.flags.inpaint_mask_sam_model, expected_type=str )