stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Bug]: "ValueError: images do not match" when inpainting Whole Picture with certain resolutions
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What happened?
Inpainting Whole Picture, and having a width of 623 causes this error to appear after the generation is nearly complete as seen in the preview.
"ValueError: images do not match"
Steps to reproduce the problem
-
Take a picture that is any weird resolution. Attached is a picture that is of resolution 623x1280
-
Put it in Img2img Inpaint - Draw a mask
-
Resolution to 623x1280, with Original + Whole Picture + Inpaint Masked.
-
Pressing Generate will cause a failure.
-
Try with various heights while maintaining the height. it will fail
What should have happened?
The image should have generated, but it seems the odd number is causing issues?
Commit where the problem happens
955df7751eef11bb7697e2d77f6b8a6226b21e13
What platforms do you use to access the UI ?
Windows
What browsers do you use to access the UI ?
Microsoft Edge
Command Line Arguments
--xformers --disable-safe-unpickle --cors-allow-origins=http://localhost:7860/ --api
List of extensions
Controlnet
Console logs
From https://github.com/AUTOMATIC1111/stable-diffusion-webui
* branch master -> FETCH_HEAD
Already up to date.
venv "G:\Workspace\stable-diffusion-webui\venv\Scripts\Python.exe"
Python 3.10.9 (tags/v3.10.9:1dd9be6, Dec 6 2022, 20:01:21) [MSC v.1934 64 bit (AMD64)]
Commit hash: 955df7751eef11bb7697e2d77f6b8a6226b21e13
Installing requirements for Web UI
Launching Web UI with arguments: --xformers --disable-safe-unpickle --cors-allow-origins=http://localhost:7860/ --api
Additional Network extension not installed, Only hijack built-in lora
LoCon Extension hijack built-in lora successfully
Checkpoint realisticVision.safetensors [c35782bad8] not found; loading fallback aresMix_v01.safetensors [6ecece11bf]
Loading weights [6ecece11bf] from G:\Workspace\stable-diffusion-webui\models\Stable-diffusion\aresMix_v01.safetensors
Creating model from config: G:\Workspace\stable-diffusion-webui\configs\v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Applying xformers cross attention optimization.
Textual inversion embeddings loaded(4): corneo_covering_breasts_two_hands, easynegative, emmsto, nataliadyer
Model loaded in 19.9s (load weights from disk: 0.5s, create model: 0.6s, apply weights to model: 11.4s, apply half(): 3.9s, move model to device: 0.7s, load textual inversion embeddings: 2.8s).
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
Startup time: 38.5s (import torch: 5.0s, import gradio: 3.2s, import ldm: 0.8s, other imports: 3.5s, list SD models: 0.3s, setup codeformer: 0.2s, load scripts: 3.7s, load SD checkpoint: 20.0s, create ui: 1.3s, gradio launch: 0.3s).
Calculating sha256 for G:\Workspace\stable-diffusion-webui\models\Stable-diffusion\realisticVisionV20_v20-inpainting.safetensors: b19fee4ab16d258fcc9df1d886f78160cbcfcc2207b140d606363ba428d6f9ab
Loading weights [b19fee4ab1] from G:\Workspace\stable-diffusion-webui\models\Stable-diffusion\realisticVisionV20_v20-inpainting.safetensors
Creating model from config: G:\Workspace\stable-diffusion-webui\configs\v1-inpainting-inference.yaml
LatentInpaintDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.54 M params.
Applying xformers cross attention optimization.
Model loaded in 21.8s (create model: 0.7s, apply weights to model: 13.8s, apply half(): 5.8s, move model to device: 1.2s, load textual inversion embeddings: 0.2s).
100%|██████████████████████████████████████████████████████████████████████████████████| 16/16 [00:07<00:00, 2.28it/s]
Error completing request███████████████████████████████████████████████████████████████| 16/16 [00:04<00:00, 3.47it/s]
Arguments: ('task(mguwvkdlbukt1nt)', 2, '', '', [], None, None, {'image': <PIL.Image.Image image mode=RGBA size=616x1280 at 0x1F57EE3FE50>, 'mask': <PIL.PngImagePlugin.PngImageFile image mode=RGBA size=616x1280 at 0x1F57EE3DD20>}, None, None, None, None, 20, 0, 0, 0, 1, False, False, 1, 1, 7, 1.5, 0.75, -1.0, -1.0, 0, 0, 0, False, 1100, 623, 0, 0, 0, 0, '', '', '', [], 0, <scripts.external_code.ControlNetUnit object at 0x000001F57F23A950>, '<ul>\n<li><code>CFG Scale</code> should be 2 or lower.</li>\n</ul>\n', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', '<p style="margin-bottom:0.75em">Recommended settings: Sampling Steps: 80-100, Sampler: Euler a, Denoising strength: 0.8</p>', 128, 8, ['left', 'right', 'up', 'down'], 1, 0.05, 128, 4, 0, ['left', 'right', 'up', 'down'], False, False, 'positive', 'comma', 0, False, False, '', '<p style="margin-bottom:0.75em">Will upscale the image by the selected scale factor; use width and height sliders to set tile size</p>', 64, 0, 2, 1, '', 0, '', 0, '', True, False, False, False, 0, None, False, 50) {}
Traceback (most recent call last):
File "G:\Workspace\stable-diffusion-webui\modules\call_queue.py", line 56, in f
res = list(func(*args, **kwargs))
File "G:\Workspace\stable-diffusion-webui\modules\call_queue.py", line 37, in f
res = func(*args, **kwargs)
File "G:\Workspace\stable-diffusion-webui\modules\img2img.py", line 171, in img2img
processed = process_images(p)
File "G:\Workspace\stable-diffusion-webui\modules\processing.py", line 486, in process_images
res = process_images_inner(p)
File "G:\Workspace\stable-diffusion-webui\modules\processing.py", line 694, in process_images_inner
image_mask_composite = Image.composite(image.convert('RGBA').convert('RGBa'), Image.new('RGBa', image.size), p.mask_for_overlay.convert('L')).convert('RGBA')
File "G:\Workspace\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 3341, in composite
image.paste(image1, None, mask)
File "G:\Workspace\stable-diffusion-webui\venv\lib\site-packages\PIL\Image.py", line 1731, in paste
self.im.paste(im, box, mask.im)
ValueError: images do not match
Additional information
No response
I got the same issue with a picture of width 960, height 540 (half of 1080 x 1920). Was able to generate the image just fine by changing the height to 536.
I got the same issue with a picture of width 960, height 540 (half of 1080 x 1920). Was able to generate the image just fine by changing the height to 536.
Has to be divisible by 8 maybe?
Yes, width and height should be divisible by 8, there was a tooltip before when you hover.
Have the same ptoblem
ValueError: images do not match
Time taken: 3m 58.29s
Torch active/reserved: 10211/10508 MiB, Sys VRAM: 11748/12045 MiB (97.53%)
This happens for me when using Tiled Diffusion + Inpaint ... however, this is one of the only ways to scale to these kinds of resolutions. I'm guessing that the inpainted sizing is an odd resolution.
For my case, when i am painting the mask (Eg: Mask for both leg which is very close together while not masking it fully: Leaving tiny gap in between) will have this error. After i fully mask the area, the error does not show up
I think this might have been introduced by #8814 - removing the changes introduced to processing.py
fixes the issue for me (cc @catboxanon)
Sorry about that. Should be fixed by that PR.
Adjusting my local code with the change from @catboxanon's PR fixed the "ValueError: images do not match" error I was getting when using 960x540 images. Big thanks!
Hey I'm still having this issue. any fixes? I've tried the divisible by 8 thing no luck especially when paired with SD Upscale, ESRGAN_4X maybe that's the issue.
would appreciate any help.
Hey I'm still having this issue. any fixes? I've tried the divisible by 8 thing no luck especially when paired with SD Upscale, ESRGAN_4X maybe that's the issue.
would appreciate any help.
Make sure the scale factor in Tiled Diffusion AND the size you set for the image in the setting lead to the same number. So for example if your image is 100x100, resize to is set 200x200, and Scaled Factor in Tiled Diffusion is set to something else than 2, you get the issue.
Closing, has been fixed by https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/9628 for quite some time.