stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Bug]: TypeError: 'NoneType' object is not subscriptable when using img2img alternative test
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What happened?
Webui fails to generate an image if using the img2img alternative test since the runway inpainting support update. Unrelated to this, it does not support the unlimited tokens either.
Steps to reproduce the problem
- Go to imgimg
- Choose img2img alternative test
- Upload image and write prompt, parameters, settings, etc.
- Generate.
What should have happened?
An image should generate.
Commit where the problem happens
bf30673f5132c8f28357b31224c54331e788d3e7
What platforms do you use to access UI ?
Windows
What browsers do you use to access the UI ?
Google Chrome
Command Line Arguments
--deepdanbooru --xformers --gradio-img2img-tool color-sketch
Additional information, context and logs
Traceback (most recent call last):
File "G:\stable-webui\modules\ui.py", line 212, in f
res = list(func(*args, **kwargs))
File "G:\stable-webui\webui.py", line 63, in f
res = func(*args, **kwargs)
File "G:\stable-webui\modules\img2img.py", line 124, in img2img
processed = modules.scripts.scripts_img2img.run(p, *args)
File "G:\stable-webui\modules\scripts.py", line 173, in run
processed = script.run(p, *script_args)
File "G:\stable-webui\scripts\img2imgalt.py", line 208, in run
processed = processing.process_images(p)
File "G:\stable-webui\modules\processing.py", line 411, in process_images
samples_ddim = p.sample(conditioning=c, unconditional_conditioning=uc, seeds=seeds, subseeds=subseeds, subseed_strength=p.subseed_strength)
File "G:\stable-webui\scripts\img2imgalt.py", line 197, in sample_extra
return sampler.sample_img2img(p, p.init_latent, noise_dt, conditioning, unconditional_conditioning)
File "G:\stable-webui\modules\sd_samplers.py", line 423, in sample_img2img
samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, xi, extra_args={
File "G:\stable-webui\modules\sd_samplers.py", line 356, in launch_sampling
return func()
File "G:\stable-webui\modules\sd_samplers.py", line 423, in
Error is caused the line below not handling image_cond being uninitialised. https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/f49c08ea566385db339c6628f65c3a121033f67c/modules/sd_samplers.py#L269
Putting an IF check fixes the issue for the img2imgalt script but I'm not sure what this line is meant to do which is a question for @random-thoughtss
image_cond_in = None
if image_cond is not None:
image_cond_in = torch.cat([torch.stack([image_cond[i] for _ in range(n)]) for i, n in enumerate(repeats)] + [image_cond])
Setting it to None would crash the in-painting model and would break if there is any batch size or large prompt.
This is the diff for the fix. Just need to add image conditioning to the img2imgalt script since it bypasses the regular img2img sampling call.
https://gist.github.com/random-thoughtss/f3ba564f4b7840136107763bdad26541