Skip to content

[Bug]: Index boundary error during img2img batch processing #12149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
1 task done
boohyunsik opened this issue Jul 28, 2023 · 8 comments
Open
1 task done

[Bug]: Index boundary error during img2img batch processing #12149

boohyunsik opened this issue Jul 28, 2023 · 8 comments
Labels
bug-report Report of a bug, yet to be confirmed

Comments

@boohyunsik
Copy link

Is there an existing issue for this?

  • I have searched the existing issues and checked the recent builds/commits

What happened?

During img2img batch processing, this error has been occured,

    Traceback (most recent call last):
      File "D:\git\stable-diffusion-webui\modules\call_queue.py", line 58, in f
        res = list(func(*args, **kwargs))
      File "D:\git\stable-diffusion-webui\modules\call_queue.py", line 37, in f
        res = func(*args, **kwargs)
      File "D:\git\stable-diffusion-webui\modules\img2img.py", line 226, in img2img
        process_batch(p, img2img_batch_input_dir, img2img_batch_output_dir, img2img_batch_inpaint_mask_dir, args, to_scale=selected_scale_tab == 1, scale_by=scale_by, use_png_info=img2img_batch_use_png_info, png_info_props=img2img_batch_png_info_props, png_info_dir=img2img_batch_png_info_dir)
      File "D:\git\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 25, in img2img_process_batch_hijack
        return getattr(img2img, '__controlnet_original_process_batch')(p, *args, **kwargs)
      File "D:\git\stable-diffusion-webui\modules\img2img.py", line 118, in process_batch
        infotext = proc.infotext(p, n)
      File "D:\git\stable-diffusion-webui\modules\processing.py", line 457, in infotext
        return create_infotext(p, self.all_prompts, self.all_seeds, self.all_subseeds, comments=[], position_in_batch=index % self.batch_size, iteration=index // self.batch_size)
      File "D:\git\stable-diffusion-webui\modules\processing.py", line 626, in create_infotext
        "Seed": p.all_seeds[0] if use_main_prompt else all_seeds[index],
    IndexError: list index out of range

Steps to reproduce the problem

  1. Go to img2img batch
  2. Setup env and run
  3. After 1st img processing, Error occured

What should have happened?

Batch processing should correctly work.

Version or Commit where the problem happens

68f336b

What Python version are you running on ?

Python 3.10.x

What platforms do you use to access the UI ?

Windows

What device are you running WebUI on?

Nvidia GPUs (RTX 20 above)

Cross attention optimization

Automatic

What browsers do you use to access the UI ?

No response

Command Line Arguments

with --no-half-vae --api

List of extensions

temporalkit, adetailer, openpose-editor, sd-webui-controlnet

Console logs

Traceback (most recent call last):
      File "D:\git\stable-diffusion-webui\modules\call_queue.py", line 58, in f
        res = list(func(*args, **kwargs))
      File "D:\git\stable-diffusion-webui\modules\call_queue.py", line 37, in f
        res = func(*args, **kwargs)
      File "D:\git\stable-diffusion-webui\modules\img2img.py", line 226, in img2img
        process_batch(p, img2img_batch_input_dir, img2img_batch_output_dir, img2img_batch_inpaint_mask_dir, args, to_scale=selected_scale_tab == 1, scale_by=scale_by, use_png_info=img2img_batch_use_png_info, png_info_props=img2img_batch_png_info_props, png_info_dir=img2img_batch_png_info_dir)
      File "D:\git\stable-diffusion-webui\extensions\sd-webui-controlnet\scripts\batch_hijack.py", line 25, in img2img_process_batch_hijack
        return getattr(img2img, '__controlnet_original_process_batch')(p, *args, **kwargs)
      File "D:\git\stable-diffusion-webui\modules\img2img.py", line 118, in process_batch
        infotext = proc.infotext(p, n)
      File "D:\git\stable-diffusion-webui\modules\processing.py", line 457, in infotext
        return create_infotext(p, self.all_prompts, self.all_seeds, self.all_subseeds, comments=[], position_in_batch=index % self.batch_size, iteration=index // self.batch_size)
      File "D:\git\stable-diffusion-webui\modules\processing.py", line 626, in create_infotext
        "Seed": p.all_seeds[0] if use_main_prompt else all_seeds[index],
    IndexError: list index out of range

Additional information

In my test, As the image processing progresses, the index increases, but it is confirmed that the seed array has only one element.

# This log is printed out by adding a print statement.
p all seed: $[1920893451]
param all seed: $[1920893451]
index: $0
p all seed: $[1920893451]
param all seed: $[1920893451]
index: $1
@boohyunsik boohyunsik added the bug-report Report of a bug, yet to be confirmed label Jul 28, 2023
@boohyunsik
Copy link
Author

I wonder exactly what the role of the use_main_prompt variable is. Shouldn't the value of this variable be True in the batch process?

@w-e-w
Copy link
Collaborator

w-e-w commented Jul 29, 2023

I did a quick test with image to image batch and wasn't able to reproduce the issue

please provide more detail steps

if I recall correctly, they have been changes to that part of the code recently
so this could be a bug that's trigger under certain edge cases

when thest also tried disabling all extensions, in case it's somehow it affects

@boohyunsik
Copy link
Author

boohyunsik commented Jul 29, 2023

My step is...

  1. Using Pre-processing in temporlkit with 30fps video
  2. Testing my prompt with 1st image with single img2img
  3. After 2, process batch img2img with my pre-processed folder. <-- 1st image is correctly processed, but next one failed.

I used 2 controlnet(openpose and temporalnet), and face-restore option.

@boohyunsik
Copy link
Author

Also there was no error when I used previous version, I forget version exactly but It is under 1.5. I will compare the variables with previous version and share it.

@w-e-w
Copy link
Collaborator

w-e-w commented Jul 29, 2023

tested the issue occurred when using combination with controlnet

@boohyunsik
Copy link
Author

Now I modified my local python file but want to modify this issue :) I am also trying fix this issue.

@ucas010
Copy link

ucas010 commented Aug 29, 2023

I did a quick test with image to image batch and wasn't able to reproduce the issue

please provide more detail steps

if I recall correctly, they have been changes to that part of the code recently so this could be a bug that's trigger under certain edge cases

when thest also tried disabling all extensions, in case it's somehow it affects

hi,dear,
could you pls share your codes for img2img with API ?
thx

@w-e-w
Copy link
Collaborator

w-e-w commented Aug 29, 2023

looking read the wiki, there's an example t2i, just change it to ITI

and this is a closed issue post not a place to ask questions

furthermore your topic is completely unrelated to the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug-report Report of a bug, yet to be confirmed
Projects
None yet
Development

No branches or pull requests

3 participants