stable-diffusion-webui
stable-diffusion-webui copied to clipboard
[Bug]: Index error in img2img
Is there an existing issue for this?
- [X] I have searched the existing issues and checked the recent builds/commits
What happened?
Using the img2img tab produces an index out of bounds error and fails to generate an image. The generation runs, and the progress bar reaches 100%, but it fails before actually outputting an image.
Steps to reproduce the problem
Any use of img2img produces the error. It occurs when generating at the original size, a different size, or when inpainting or with a script like SD Upscaler, and for any combination of parameters that I tested. However, the hires. fix in the txt2img tab functions correctly, and does successfully generate an image.
What should have happened?
The image should be produced as expected.
Commit where the problem happens
https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/3715ece0adce7bf7c5e9c5ab3710b2fdc3848f39
What platforms do you use to access the UI ?
Linux
What browsers do you use to access the UI ?
No response
Command Line Arguments
export COMMANDLINE_ARGS="--no-half-vae --deepdanbooru"
export TORCH_COMMAND="pip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/rocm5.2"
export GRADIO_ANALYTICS_ENABLED="False"
List of extensions
No.
Console logs
################################################################
Install script for stable-diffusion + Web UI
Tested on Debian 11 (Bullseye)
################################################################
################################################################
Running on anon user
################################################################
################################################################
Repo already cloned, using it as install directory
################################################################
################################################################
Create and activate python venv
################################################################
################################################################
Launching launch.py...
################################################################
Python 3.7.6 (default, Jan 8 2020, 19:59:22)
[GCC 7.3.0]
Commit hash: 3715ece0adce7bf7c5e9c5ab3710b2fdc3848f39
Installing requirements for Web UI
Launching Web UI with arguments: --no-half-vae --deepdanbooru
2023-02-13 15:55:50.517577: I tensorflow/core/platform/cpu_feature_guard.cc:193] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
2023-02-13 15:55:50.583681: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudart.so.11.0'; dlerror: libcudart.so.11.0: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/anon/AI/stable-diffusion-webui/venv/lib/python3.7/site-packages/cv2/../../lib64::/opt/EDTpdv
2023-02-13 15:55:50.583699: I tensorflow/stream_executor/cuda/cudart_stub.cc:29] Ignore above cudart dlerror if you do not have a GPU set up on your machine.
2023-02-13 15:55:50.597558: E tensorflow/stream_executor/cuda/cuda_blas.cc:2981] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2023-02-13 15:55:50.954428: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer.so.7'; dlerror: libnvinfer.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/anon/AI/stable-diffusion-webui/venv/lib/python3.7/site-packages/cv2/../../lib64::/opt/EDTpdv
2023-02-13 15:55:50.954491: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libnvinfer_plugin.so.7'; dlerror: libnvinfer_plugin.so.7: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /home/anon/AI/stable-diffusion-webui/venv/lib/python3.7/site-packages/cv2/../../lib64::/opt/EDTpdv
2023-02-13 15:55:50.954497: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Cannot dlopen some TensorRT libraries. If you would like to use Nvidia GPU with TensorRT, please make sure the missing libraries mentioned above are installed properly.
No module 'xformers'. Proceeding without it.
==============================================================================
You are running torch 1.12.1+rocm5.1.1.
The program is tested to work with torch 1.13.1.
To reinstall the desired version, run with commandline flag --reinstall-torch.
Beware that this will cause a lot of large files to be downloaded, as well as
there are reports of issues with training tab on the latest version.
Use --skip-version-check commandline argument to disable this check.
==============================================================================
Loading weights [038ba203d8] from /home/anon/AI/stable-diffusion-webui/models/Stable-diffusion/AbyssOrangeMix2_sfw.safetensors
Creating model from config: /home/anon/AI/stable-diffusion-webui/configs/v1-inference.yaml
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
Couldn't find VAE named Anything-V30.vae.pt; using None instead
Applying cross attention optimization (Doggettx).
Textual inversion embeddings loaded(1): bad_prompt_version2
Model loaded in 1.6s (create model: 0.3s, apply weights to model: 0.5s, apply half(): 0.3s, load VAE: 0.1s, move model to device: 0.3s).
Running on local URL: http://127.0.0.1:7860
To create a public link, set `share=True` in `launch()`.
MIOpen(HIP): Warning [SQLiteBase] Missing system database file: /home/anon/AI/stable-diffusion-webui/venv/lib/python3.7/site-packages/torch/share/miopen/db/gfx1030_36.kdb Performance may degrade. Please follow instructions to install: https://github.com/ROCmSoftwarePlatform/MIOpen#installing-miopen-kernels-package
100%|█████████████████████████████████████████████████████████████████████| 22/22 [00:26<00:00, 1.19s/it]
Error completing request██████████████████████████████████████████████████| 22/22 [00:04<00:00, 4.76it/s]
Arguments: ('task(qm5e9uvu47jew80)', 0, '<lora:ke-tav2:0.7>, 1girl solo, konpaku youmu, sitting, smiling, looking at viewer', 'bad_prompt_version2, (worst quality, low quality:1.3), (depth of field, blurry:1.2), (greyscale, monochrome:1.1), 3D face, nose, cropped, lowres, text, jpeg artifacts, signature, watermark, username, blurry, artist name, trademark, watermark, title, (chibi, sd character:1.1), multiple view, Reference sheet', [], <PIL.Image.Image image mode=RGBA size=512x704 at 0x7FF282CB8D10>, None, None, None, None, None, None, 28, 5, 4, 0, 1, False, False, 1, 1, 7, 1.5, 0.75, 2686143048.0, -1.0, 0, 0, 0, False, 704, 512, 0, 0, 32, 0, '', '', '', [], 0, '<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, 1, '<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) {}
Traceback (most recent call last):
File "/home/anon/AI/stable-diffusion-webui/modules/call_queue.py", line 56, in f
res = list(func(*args, **kwargs))
File "/home/anon/AI/stable-diffusion-webui/modules/call_queue.py", line 37, in f
res = func(*args, **kwargs)
File "/home/anon/AI/stable-diffusion-webui/modules/img2img.py", line 169, in img2img
processed = process_images(p)
File "/home/anon/AI/stable-diffusion-webui/modules/processing.py", line 486, in process_images
res = process_images_inner(p)
File "/home/anon/AI/stable-diffusion-webui/modules/processing.py", line 671, in process_images_inner
image = apply_color_correction(p.color_corrections[i], image)
File "/home/anon/AI/stable-diffusion-webui/modules/processing.py", line 55, in apply_color_correction
image = blendLayers(image, original_image, BlendType.LUMINOSITY)
File "/home/anon/AI/stable-diffusion-webui/venv/lib/python3.7/site-packages/blendmodes/blend.py", line 501, in blendLayers
backgroundAlpha = npBackground[:, :, 3]
IndexError: index 3 is out of bounds for axis 2 with size 3
Additional information
No response
a wild guess, you have apply color correction enabled and you're using jpeg as samples format?
"Apply color correction to img2img results to match original colors" was on, and turning it off solves the problem. I'm not entirely sure what it does beyond what the name implies, but it appears that that is what is bugged.
And no, it was a png, fed straight from txt2img output into img2img. if you mean something else, I didn't see anything in the options about "samples format".
It does exactly what name applies - it tried to modify the color balance of resulting image with color balance of the input image. But it goes wrong while extracting background layer.
Still a bug and should be addressed, but at least you're not blocked until then.
Yes I had the same problem today. Img2Img creating a large grid, failed. Kind of a bummer after running for 8+ hours for a complex xyz plot. Not sure how to rectify this and run it again.
anyone have an answer - it did work but does not anymore