From 2b83f942afdd4a5911a83982444b54bae2cba32a Mon Sep 17 00:00:00 2001 From: Sean Sube Date: Sat, 18 Feb 2023 18:54:24 -0600 Subject: [PATCH] restore original LPW names --- api/onnx_web/chain/blend_inpaint.py | 4 ++-- .../diffusion/lpw_stable_diffusion_onnx.py | 22 +++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/api/onnx_web/chain/blend_inpaint.py b/api/onnx_web/chain/blend_inpaint.py index 11e042f5..783f9fb4 100644 --- a/api/onnx_web/chain/blend_inpaint.py +++ b/api/onnx_web/chain/blend_inpaint.py @@ -85,7 +85,7 @@ def blend_inpaint( height=size.height, image=tile_source, latents=latents, - mask=tile_mask, + mask_image=tile_mask, negative_prompt=params.negative_prompt, num_inference_steps=params.steps, width=size.width, @@ -100,7 +100,7 @@ def blend_inpaint( height=size.height, image=tile_source, latents=latents, - mask=mask, + mask_image=mask, negative_prompt=params.negative_prompt, num_inference_steps=params.steps, width=size.width, diff --git a/api/onnx_web/diffusion/lpw_stable_diffusion_onnx.py b/api/onnx_web/diffusion/lpw_stable_diffusion_onnx.py index 8d369617..51a91780 100644 --- a/api/onnx_web/diffusion/lpw_stable_diffusion_onnx.py +++ b/api/onnx_web/diffusion/lpw_stable_diffusion_onnx.py @@ -657,7 +657,7 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline prompt: Union[str, List[str]], negative_prompt: Optional[Union[str, List[str]]] = None, image: Union[np.ndarray, PIL.Image.Image] = None, - mask: Union[np.ndarray, PIL.Image.Image] = None, + mask_image: Union[np.ndarray, PIL.Image.Image] = None, height: int = 512, width: int = 512, num_inference_steps: int = 50, @@ -687,9 +687,9 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline image (`np.ndarray` or `PIL.Image.Image`): `Image`, or tensor representing an image batch, that will be used as the starting point for the process. - mask (`np.ndarray` or `PIL.Image.Image`): + mask_image (`np.ndarray` or `PIL.Image.Image`): `Image`, or tensor representing an image batch, to mask `image`. White pixels in the mask will be - replaced by noise and therefore repainted, while black pixels will be preserved. If `mask` is a + replaced by noise and therefore repainted, while black pixels will be preserved. If `mask_image` is a PIL image, it will be converted to a single channel (luminance) before use. If it's a tensor, it should contain one color channel (L) instead of 3, so the expected shape would be `(B, H, W, 1)`. height (`int`, *optional*, defaults to 512): @@ -782,10 +782,10 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline image = preprocess_image(image) if image is not None: image = image.astype(dtype) - if isinstance(mask, PIL.Image.Image): - mask = preprocess_mask(mask, self.vae_scale_factor) - if mask is not None: - mask = mask.astype(dtype) + if isinstance(mask_image, PIL.Image.Image): + mask_image = preprocess_mask(mask_image, self.vae_scale_factor) + if mask_image is not None: + mask = mask_image.astype(dtype) mask = np.concatenate([mask] * batch_size * num_images_per_prompt) else: mask = None @@ -1057,7 +1057,7 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline def inpaint( self, image: Union[np.ndarray, PIL.Image.Image], - mask: Union[np.ndarray, PIL.Image.Image], + mask_image: Union[np.ndarray, PIL.Image.Image], prompt: Union[str, List[str]], negative_prompt: Optional[Union[str, List[str]]] = None, strength: float = 0.8, @@ -1079,9 +1079,9 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline image (`np.ndarray` or `PIL.Image.Image`): `Image`, or tensor representing an image batch, that will be used as the starting point for the process. This is the image whose masked region will be inpainted. - mask (`np.ndarray` or `PIL.Image.Image`): + mask_image (`np.ndarray` or `PIL.Image.Image`): `Image`, or tensor representing an image batch, to mask `image`. White pixels in the mask will be - replaced by noise and therefore repainted, while black pixels will be preserved. If `mask` is a + replaced by noise and therefore repainted, while black pixels will be preserved. If `mask_image` is a PIL image, it will be converted to a single channel (luminance) before use. If it's a tensor, it should contain one color channel (L) instead of 3, so the expected shape would be `(B, H, W, 1)`. prompt (`str` or `List[str]`): @@ -1136,7 +1136,7 @@ class OnnxStableDiffusionLongPromptWeightingPipeline(OnnxStableDiffusionPipeline prompt=prompt, negative_prompt=negative_prompt, image=image, - mask=mask, + mask_image=mask_image, num_inference_steps=num_inference_steps, guidance_scale=guidance_scale, strength=strength,