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

save button causes a soft crash in loopback and inpaint. (IndexError: tuple index out of range)

Open USBhost opened this issue 3 years ago • 8 comments

Describe the bug when you try to save any individual picture except the first picture (like the grid) in img2img loopback or inpaint you get "IndexError: tuple index out of range" error.

To Reproduce Steps to reproduce the behavior:

  1. Generate anything, then send one to img2img or inpaint.
  2. Go to img2img tab and select loopback script or inpaint (if you sent the pic there)
  3. Set batch count to something more than 1, then generate.
  4. Try saving any pic but the first one (that one will save) and you get the soft crash.

Expected behavior save selected picture.

The error Inpaint

Error completing request
Arguments: ('{"prompt": "masterpiece, best quality, cat, bird", "all_prompts": ["masterpiece, best quality, cat, bird"], "negative_prompt": "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, medium breasts, large breasts, huge breasts, very short hair, short hair, medium hair.", "seed": 3691611137, "all_seeds": [3691611137], "subseed": -1, "all_subseeds": [-1], "subseed_strength": 0, "width": 512, "height": 512, "sampler_index": 0, "sampler": "Euler a", "cfg_scale": 7, "steps": 28, "batch_size": 1, "restore_faces": false, "face_restoration_model": null, "sd_model_hash": "925997e9", "seed_resize_from_w": 0, "seed_resize_from_h": 0, "denoising_strength": 0.75, "extra_generation_params": {"Denoising strength change factor": 1}, "index_of_first_image": 0, "infotexts": ["masterpiece, best quality, cat, bird\\nNegative prompt: lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, medium breasts, large breasts, huge breasts, very short hair, short hair, medium hair.\\nSteps: 28, Sampler: Euler a, CFG scale: 7, Seed: 3691611137, Size: 512x512, Model hash: 925997e9, Denoising strength: 0.75, Clip skip: 2, ENSD: 31337, Denoising strength change factor: 1"], "styles": ["None", "None"], "job_timestamp": "20221016094712", "clip_skip": 2}', [{'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp39z6fcl7.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp39z6fcl7.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpyj48g8vs.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpyj48g8vs.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp7s5t6w4t.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp7s5t6w4t.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmprl9a67xu.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmprl9a67xu.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp0e9e2hip.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp0e9e2hip.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpzih2_v6v.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpzih2_v6v.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp7xdpmn_6.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp7xdpmn_6.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmppu_pto2c.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmppu_pto2c.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpnk3thjrb.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpnk3thjrb.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp5y1p4lvt.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp5y1p4lvt.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpvlr52jka.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpvlr52jka.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpqc81tzhr.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpqc81tzhr.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpfn38l962.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpfn38l962.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp1e8lr5a1.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp1e8lr5a1.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpibez9g47.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpibez9g47.png', 'is_file': True}], False, 9) {}
Traceback (most recent call last):
  File "C:\comp\stable-diffusion-webui\modules\ui.py", line 212, in f
    res = list(func(*args, **kwargs))
  File "C:\comp\stable-diffusion-webui\modules\ui.py", line 162, in save_files
    fullfn, txt_fullfn = save_image(image, path, "", seed=p.all_seeds[i], prompt=p.all_prompts[i], extension=extension, info=p.infotexts[image_index], grid=is_grid, p=p, save_to_dirs=save_to_dirs)
IndexError: list index out of range

Traceback (most recent call last):
  File "C:\comp\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 275, in run_predict
    output = await app.blocks.process_api(
  File "C:\comp\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 791, in process_api
    predictions = self.postprocess_data(fn_index, result["prediction"], state)
  File "C:\comp\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 742, in postprocess_data
    if predictions[i] is components._Keywords.FINISHED_ITERATING:
IndexError: tuple index out of range

loopback

Error completing request
Arguments: ('{"prompt": "masterpiece, best quality, cat, bird", "all_prompts": ["masterpiece, best quality, cat, bird"], "negative_prompt": "lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, medium breasts, large breasts, huge breasts, very short hair, short hair, medium hair.", "seed": 3276342138, "all_seeds": [3276342138], "subseed": -1, "all_subseeds": [-1], "subseed_strength": 0, "width": 512, "height": 512, "sampler_index": 0, "sampler": "Euler a", "cfg_scale": 7, "steps": 28, "batch_size": 1, "restore_faces": false, "face_restoration_model": null, "sd_model_hash": "925997e9", "seed_resize_from_w": 0, "seed_resize_from_h": 0, "denoising_strength": 0.75, "extra_generation_params": {"Denoising strength change factor": 1}, "index_of_first_image": 0, "infotexts": ["masterpiece, best quality, cat, bird\\nNegative prompt: lowres, bad anatomy, bad hands, text, error, missing fingers, extra digit, fewer digits, cropped, worst quality, low quality, normal quality, jpeg artifacts, signature, watermark, username, blurry, medium breasts, large breasts, huge breasts, very short hair, short hair, medium hair.\\nSteps: 28, Sampler: Euler a, CFG scale: 7, Seed: 3276342138, Size: 512x512, Model hash: 925997e9, Denoising strength: 0.75, Clip skip: 2, ENSD: 31337, Denoising strength change factor: 1"], "styles": ["None", "None"], "job_timestamp": "20221016101133", "clip_skip": 2}', [{'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpicfugela.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpicfugela.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpan45tmxf.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpan45tmxf.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp1ceirpzz.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp1ceirpzz.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp8nteufod.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp8nteufod.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpg0inz435.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpg0inz435.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmptv8xoe2i.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmptv8xoe2i.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpvno3w4xy.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpvno3w4xy.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpnuaj28pe.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmpnuaj28pe.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp2mt9qwhn.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp2mt9qwhn.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp0x15q54k.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp0x15q54k.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp5xfleijz.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp5xfleijz.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp7pl4gtrq.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp7pl4gtrq.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp9qvl_hvz.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp9qvl_hvz.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp2nahlnzp.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmp2nahlnzp.png', 'is_file': True}, {'name': 'C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmphmzck4kg.png', 'data': 'file=C:\\Users\\USBhost\\AppData\\Local\\Temp\\tmpnj94fede\\tmphmzck4kg.png', 'is_file': True}], False, 8) {}
Traceback (most recent call last):
  File "C:\comp\stable-diffusion-webui\modules\ui.py", line 212, in f
    res = list(func(*args, **kwargs))
  File "C:\comp\stable-diffusion-webui\modules\ui.py", line 162, in save_files
    fullfn, txt_fullfn = save_image(image, path, "", seed=p.all_seeds[i], prompt=p.all_prompts[i], extension=extension, info=p.infotexts[image_index], grid=is_grid, p=p, save_to_dirs=save_to_dirs)
IndexError: list index out of range

Traceback (most recent call last):
  File "C:\comp\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 275, in run_predict
    output = await app.blocks.process_api(
  File "C:\comp\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 791, in process_api
    predictions = self.postprocess_data(fn_index, result["prediction"], state)
  File "C:\comp\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 742, in postprocess_data
    if predictions[i] is components._Keywords.FINISHED_ITERATING:
IndexError: tuple index out of range

Desktop (please complete the following information):

  • OS: Windows 10
  • Browser Brave with ad blocking off for localhost
  • Commit revision c57919ea2a8e4a23a05d21f28928e08bbf34c59e

USBhost avatar Oct 16 '22 15:10 USBhost

Seconding this, though I'm having a different custom script enabled (external masking), it actually has been like this for a while for me, thought it was a custom script issue, but from your issue apparently this happens whenever you have any script enabled.

Other things I've noticed, generation info seems to have stopped working for me when I enable external masking, the generated .txt file does not have anything in it, the reuse seed function also stopped working, and extra tab does not read any info(seed, model, prompt, etc) after sent to extra. Could this loopback be caused by trying to pull a seed number to rename the saved image when the generation info stopped working?

Oh, and history tab doesn't have anything no matter what I generate as long as external masking is enabled, I did not even know this was added because of it, not sure if you have this problem as well with loopback.

VantomPayne avatar Oct 16 '22 15:10 VantomPayne

I'm seeing similar just hitting save in txt2img:

  File "C:\Users\eadna\stable-diffusion-webui\modules\ui.py", line 212, in f
    res = list(func(*args, **kwargs))
  File "C:\Users\eadna\stable-diffusion-webui\modules\ui.py", line 145, in save_files
    images = [images[index]]
IndexError: list index out of range

Traceback (most recent call last):
  File "C:\Users\eadna\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 275, in run_predict
    output = await app.blocks.process_api(
  File "C:\Users\eadna\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 791, in process_api
    predictions = self.postprocess_data(fn_index, result["prediction"], state)
  File "C:\Users\eadna\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 742, in postprocess_data
    if predictions[i] is components._Keywords.FINISHED_ITERATING:
IndexError: tuple index out of range```

eadnams22 avatar Oct 16 '22 16:10 eadnams22

I also get IndexError: tuple index out of range in txt2img when trying to save the last image generated in any prompt. Saving images works fine for every image but the last one in txt2img for me.

r-bassi avatar Oct 17 '22 00:10 r-bassi

I get this when trying to merge the new inpainting model with any standard one.

shadinx2 avatar Oct 23 '22 09:10 shadinx2

I can confirm I have the exact problem when using sd upscale script.

Manimap avatar Nov 06 '22 12:11 Manimap

I get this issue when using Outpainting MK2:

Arguments: ('{"prompt": "a beautiful ultradetailed painting of a tall castle with walls of cobblestone visible over the treeline of a red maple, golden hour, albert bierstadt, makoto shinkai, 4k, trending on artstation", "all_prompts": ["a beautiful ultradetailed painting of a tall castle with walls of cobblestone visible over the treeline of a red maple, golden hour, albert bierstadt, makoto shinkai, 4k, trending on artstation"], "negative_prompt": "", "seed": 328368278, "all_seeds": [328368278], "subseed": -1, "all_subseeds": [-1], "subseed_strength": 0, "width": 640, "height": 768, "sampler_index": 0, "sampler": "Euler a", "cfg_scale": 7, "steps": 30, "batch_size": 1, "restore_faces": false, "face_restoration_model": null, "sd_model_hash": "81761151", "seed_resize_from_w": 0, "seed_resize_from_h": 0, "denoising_strength": 0.75, "extra_generation_params": {"Mask blur": 4}, "index_of_first_image": 0, "infotexts": ["a beautiful ultradetailed painting of a tall castle with walls of cobblestone visible over the treeline of a red maple, golden hour, albert bierstadt, makoto shinkai, 4k, trending on artstation\nSteps: 30, Sampler: Euler a, CFG scale: 7, Seed: 328368278, Size: 640x768, Model hash: 81761151, Denoising strength: 0.75, Mask blur: 4"], "styles": ["None", "None"], "job_timestamp": "20221107174312", "clip_skip": 1}', [{'name': 'C:\Users\cpgsa\AppData\Local\Temp\tmphzm_1bgx\tmp67mglhel.png', 'data': 'file=C:\Users\cpgsa\AppData\Local\Temp\tmphzm_1bgx\tmp67mglhel.png', 'is_file': True}, {'name': 'C:\Users\cpgsa\AppData\Local\Temp\tmphzm_1bgx\tmp20se24cq.png', 'data': 'file=C:\Users\cpgsa\AppData\Local\Temp\tmphzm_1bgx\tmp20se24cq.png', 'is_file': True}, {'name': 'C:\Users\cpgsa\AppData\Local\Temp\tmphzm_1bgx\tmp7ss3r_r6.png', 'data': 'file=C:\Users\cpgsa\AppData\Local\Temp\tmphzm_1bgx\tmp7ss3r_r6.png', 'is_file': True}], True, 1) {}
Traceback (most recent call last):
File "C:\SD\stable-diffusion-webui\modules\ui.py", line 185, in f
res = list(func(*args, **kwargs))
File "C:\SD\stable-diffusion-webui\modules\ui.py", line 136, in save_files
fullfn, txt_fullfn = save_image(image, path, "", seed=p.all_seeds[i], prompt=p.all_prompts[i], extension=extension, info=p.infotexts[image_index], grid=is_grid, p=p, save_to_dirs=save_to_dirs)
IndexError: list index out of range

Traceback (most recent call last):
File "c:\SD\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 284, in run_predict
output = await app.blocks.process_api(
File "c:\SD\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 983, in process_api
data = self.postprocess_data(fn_index, result["prediction"], state)
File "c:\SD\stable-diffusion-webui\venv\lib\site-packages\gradio\blocks.py", line 913, in postprocess_data
if predictions[i] is components._Keywords.FINISHED_ITERATING:
IndexError: tuple index out of range```

githubUser01946 avatar Nov 08 '22 09:11 githubUser01946

I'll add just using txt2img in a batch will cause failure using save. It's why I asked if we could have a delete button for unsatisfying batch runs. https://github.com/AUTOMATIC1111/stable-diffusion-webui/discussions/4866

Remowylliams avatar Nov 20 '22 02:11 Remowylliams

Removed the read-only attribute from the stable diffusion folder, the error is gone

Uahn avatar Apr 18 '23 14:04 Uahn

I added the problem encountered by openpose in controlNet. It is actually because controlNet outputs a skeleton diagram. Just change the saving part of the code.Enter the function and subtract 1 from the array subscript.Modify the following code: fullfn, txt_fullfn = modules.images.save_image(image, path, "", seed=p.all_seeds[i], prompt=p.all_prompts[i], extension=extension, info=p.infotexts[image_index], grid=is_grid, p=p, save_to_dirs=save_to_dirs)

longanhe avatar Oct 26 '23 07:10 longanhe