mirror of
https://github.com/vladmandic/automatic
synced 2026-09-20 01:31:13 +02:00
masking error handler
Co-authored-by: Copilot <copilot@github.com> Signed-off-by: Vladimir Mandic <mandic00@live.com>
This commit is contained in:
+8
-2
@@ -385,7 +385,9 @@ def outpaint(input_image: Image.Image, outpaint_type: str = 'Edge'):
|
||||
|
||||
|
||||
def run_mask(input_image: Image.Image, input_mask: Image.Image | None = None, return_type: str | None = None, mask_blur: int | None = None, mask_padding: int | None = None, invert=None):
|
||||
if isinstance(input_image, list) and len(input_image) > 0:
|
||||
if input_image is None:
|
||||
return input_mask
|
||||
elif isinstance(input_image, list) and len(input_image) > 0:
|
||||
input_image = input_image[0]
|
||||
elif isinstance(input_image, dict):
|
||||
input_mask = input_image.get('mask', None)
|
||||
@@ -401,7 +403,11 @@ def run_mask(input_image: Image.Image, input_mask: Image.Image | None = None, re
|
||||
debug(f'Run mask: fn={fn}') # pylint: disable=protected-access
|
||||
debug(f'Run mask: opts={opts}') # pylint: disable=protected-access
|
||||
|
||||
size = min(input_image.width, input_image.height)
|
||||
try:
|
||||
size = min(input_image.width, input_image.height)
|
||||
except Exception as e:
|
||||
log.error(f'Mask input image error: {e}')
|
||||
return input_mask
|
||||
if invert is not None:
|
||||
opts.invert = invert
|
||||
|
||||
|
||||
@@ -152,7 +152,7 @@ def set_prompt(p,
|
||||
negative_attention_masks = prompt_parser_diffusers.embedder('negative_prompt_attention_masks')
|
||||
|
||||
if negative_embeds is None:
|
||||
log.warning('Prompt parser encode: empty negative prompt embeds')
|
||||
# log.warning('Prompt parser encode: empty negative prompt embeds')
|
||||
prompt_parser_diffusers.embedder = None
|
||||
args = set_fallback_prompt(args, possible, prompts=None, negative_prompts=negative_prompts, prompts_2=None, negative_prompts_2=None)
|
||||
prompt_attention = 'fixed'
|
||||
|
||||
@@ -16,7 +16,7 @@ def http_get_hijack(*args, **kwargs):
|
||||
fn = kwargs.get("displayed_filename", None)
|
||||
size = kwargs.get("expected_size", None)
|
||||
if fn and not fn.endswith(".json") and size is not None and size > 10240:
|
||||
log.debug(f'Download start: type=http fn="{fn}" size={size}')
|
||||
log.debug(f'Download: type=http fn="{fn}" size={size}')
|
||||
debug(f'Download start: type=http args={args} kwargs={kwargs}')
|
||||
t0 = time.time()
|
||||
res = orig_http_get(*args, **kwargs)
|
||||
@@ -34,7 +34,7 @@ def xet_get_hijack(*args, **kwargs):
|
||||
fn = kwargs.get("displayed_filename", None)
|
||||
size = kwargs.get("expected_size", None)
|
||||
if fn and not fn.endswith(".json"):
|
||||
log.debug(f'Download start: type=xet fn="{fn}" size={size}')
|
||||
log.debug(f'Download: type=xet fn="{fn}" size={size}')
|
||||
debug(f'Download start: type=xet args={args} kwargs={kwargs}')
|
||||
res = orig_xet_get(*args, **kwargs)
|
||||
debug(f'Download end: type=xet res={res}')
|
||||
|
||||
Reference in New Issue
Block a user