stable-diffusion-webui icon indicating copy to clipboard operation
stable-diffusion-webui copied to clipboard

img2img alternate script now CRASHING (was working 2 days ago)

Open arpitest opened this issue 2 years ago • 6 comments

Describe the bug

File "/home/arpi/stable/GUI/stable-diffusion-webui/modules/img2img.py", line 124, in img2img processed = modules.scripts.scripts_img2img.run(p, *args) File "/home/arpi/stable/GUI/stable-diffusion-webui/modules/scripts.py", line 159, in run processed = script.run(p, *script_args) File "/home/arpi/stable/GUI/stable-diffusion-webui/scripts/img2imgalt.py", line 180, in run processed = processing.process_images(p) File "/home/arpi/stable/GUI/stable-diffusion-webui/modules/processing.py", line 400, in process_images samples_ddim = p.sample(conditioning=c, unconditional_conditioning=uc, seeds=seeds, subseeds=subseeds, subseed_strength=p.subseed_strength) File "/home/arpi/stable/GUI/stable-diffusion-webui/scripts/img2imgalt.py", line 152, in sample_extra rec_noise = find_noise_for_image_sigma_adjustment(p, cond, uncond, cfg, st) File "/home/arpi/stable/GUI/stable-diffusion-webui/scripts/img2imgalt.py", line 79, in find_noise_for_image_sigma_adjustment cond_in = torch.cat([uncond, cond]) RuntimeError: Sizes of tensors must match except in dimension 0. Expected size 77 but got size 154 for tensor number 1 in the list.

To Reproduce Steps to reproduce the behavior: upload (or use send to img2img) an 512x512 image to img2img tab. select img2img alternate test script set target size 1024x1024 (set steps, cfg scale, denoise etc values too, but they does not affect this bug) press Generate!

Expected behavior It should render an upscaled version of the uploaded image, without major differences. Now it's CRASHING. It did work until now (2 days old version for sure, dont know which recent commit broke that)

Desktop (please complete the following information):

  • OS: Linux, Ubuntu 18 lts server, python 3.8.13
  • Browser: Firefox latest on MacoS
  • Commit revision ed769977f0d0f201d8e361d365102f18775fc62c

arpitest avatar Oct 10 '22 17:10 arpitest

hmm, it's broken even if i set 512x512 as target size, or if i upload already upscaled 1024x1024 image...

arpitest avatar Oct 10 '22 17:10 arpitest

@arpitest is this still an issue?

ClashSAN avatar Oct 26 '22 16:10 ClashSAN

Im not sure if Im running into the same issue but in img2img when I try to upscale an image now it only pumps out 512 images even if I feed it a larger image. Thought it was a issue on my end with flags I was using or a recent update but I can't seem to get it to make larger than 512s anymore.

jcroy avatar Oct 28 '22 16:10 jcroy

@arpitest is this still an issue?

it is working now. even with xformers, it did not work a week ago yet.

arpitest avatar Oct 29 '22 09:10 arpitest

Unfortunately still don't work. Attempting to run that script failed with an exactly the same error.

How to reproduce:

  1. Send generated 512x512 or upload 512x512 to img2img tab.
  2. Just apply the script "img2img alternate script" with the same output resolution image settings 512x512. Script params does not effect at all.
Traceback (most recent call last):
  File "E:\projects\stableDiffusion\stable-diffusion-webui\modules\ui.py", line 185, in f
    res = list(func(*args, **kwargs))
  File "E:\projects\stableDiffusion\stable-diffusion-webui\webui.py", line 57, in f
    res = func(*args, **kwargs)
  File "E:\projects\stableDiffusion\stable-diffusion-webui\modules\img2img.py", line 138, in img2img
    processed = modules.scripts.scripts_img2img.run(p, *args)
  File "E:\projects\stableDiffusion\stable-diffusion-webui\modules\scripts.py", line 317, in run
    processed = script.run(p, *script_args)
  File "E:\projects\stableDiffusion\stable-diffusion-webui\scripts\img2imgalt.py", line 213, in run
    processed = processing.process_images(p)
  File "E:\projects\stableDiffusion\stable-diffusion-webui\modules\processing.py", line 430, in process_images
    res = process_images_inner(p)
  File "E:\projects\stableDiffusion\stable-diffusion-webui\modules\processing.py", line 531, in process_images_inner
    samples_ddim = p.sample(conditioning=c, unconditional_conditioning=uc, seeds=seeds, subseeds=subseeds, subseed_strength=p.subseed_strength, prompts=prompts)
  File "E:\projects\stableDiffusion\stable-diffusion-webui\scripts\img2imgalt.py", line 187, in sample_extra
    rec_noise = find_noise_for_image(p, cond, uncond, cfg, st)
  File "E:\projects\stableDiffusion\stable-diffusion-webui\scripts\img2imgalt.py", line 35, in find_noise_for_image
    cond_in = torch.cat([uncond, cond])
RuntimeError: Sizes of tensors must match except in dimension 0. Expected size 77 but got size 154 for tensor number 1 in the list.

mpolsky avatar Nov 25 '22 16:11 mpolsky

Experimentally came to the conclusion, that an issue occurs in a case when a prompt exceed 75 tokens. With a prompt of tokens under 75 everything works like a charm.

mpolsky avatar Nov 25 '22 18:11 mpolsky