Skip to content

Commit

Permalink
Merge pull request #3472 from lllyasviel/develop
Browse files Browse the repository at this point in the history
fix: adjust validation of config settings
  • Loading branch information
mashb1t authored Aug 8, 2024
2 parents 2c78cec + 8bd9ea1 commit fd74b57
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -698,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
)

Expand Down

0 comments on commit fd74b57

Please sign in to comment.