Skip to content

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

@boohyunsik

Description

@boohyunsik

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bug-reportReport of a bug, yet to be confirmed

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions