stable-diffusion-webui
stable-diffusion-webui copied to clipboard
No images are being saved by Save button
Describe the bug
OK I thought this was for "save all images" as well but it's not. That seems to be working. When I refreshed the interface it unset the checkbox for saving all images. I did it twice and both times the checkbox was unchecked even though I applied the settings. The third time the setting stayed in place. Not sure what that was about, the only difference was that I restarted the server the first two times. Anyway, this bug is only for the save button. I pulled another update since the first report but it is still not saving. Now on d3463bc59a44d62c2de8b357184c49876d84f654
Save button not working. Just pulled latest release and am getting the error. Message in cmd window at the bottom of this bug report. I am generating a single image. I always have auto-save turned off in settings and only save using the save button to an "outputs/savedimages" folder. This has always worked until now.
To Reproduce Steps to reproduce the behavior: (see above for custom settings)
- Go to Text2Img
- Set params for image generation.
- Start generation. Press Save button when image appears.
- See error
Expected behavior An image will be saved to outputs/savedimages
Desktop (please complete the following information):
- OS: Win 11
- Browser Firefox
- Commit revision f7ca63937ac83d32483285c3af09afaa356d6276
Additional context Traceback (most recent call last): File "C:\Python projects\stable-diffusion-webui\modules\ui.py", line 205, in f res = list(func(*args, **kwargs)) File "C:\Python projects\stable-diffusion-webui\modules\ui.py", line 147, in save_files if filedata.startswith("data:image/png;base64,"): AttributeError: 'dict' object has no attribute 'startswith'
Traceback (most recent call last): File "c:\Python projects\stable-diffusion-webui\venv\lib\site-packages\gradio\routes.py", line 275, in run_predict output = await app.blocks.process_api( File "c:\Python projects\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:\Python projects\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
#2712 maybe same issue?
temporary solution
# ui.py line 91
def image_from_url_text(filedata):
if type(filedata) == dict:
if 'name' in filedata:
return Image.open(filedata['name'])
if type(filedata) == list:
if len(filedata) == 0:
return None
filedata = filedata[0]
# filedata is empty when clicking send to img2img while on the img2img tab
if filedata is None:
return None
if filedata.startswith("data:image/png;base64,"):
filedata = filedata[len("data:image/png;base64,"):]
filedata = base64.decodebytes(filedata.encode('utf-8'))
image = Image.open(io.BytesIO(filedata))
return image
Could be related indeed. Will check it out later thanks.
same issue, but this problem is at save files (line 115) function...
ui.py, near line 150
with open(os.path.join(opts.outdir_save, "log.csv"), "a", encoding="utf8", newline='') as file:
at_start = file.tell() == 0
writer = csv.writer(file)
if at_start:
writer.writerow(["prompt", "seed", "width", "height", "sampler", "cfgs", "steps", "filename", "negative_prompt"])
# ↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓↓
for image_index, filedata in enumerate(images, start_index):
if isinstance(filedata, dict) and "name" in filedata:
image = Image.open(filedata["name"])
else:
if filedata.startswith("data:image/png;base64,"):
filedata = filedata[len("data:image/png;base64,"):]
image = Image.open(io.BytesIO(base64.decodebytes(filedata.encode('utf-8'))))
# ↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑
is_grid = image_index < p.index_of_first_image
i = 0 if is_grid else (image_index - p.index_of_first_image)
Thank you bing-su that worked perfectly. I'll leave this open until it is fixed.
I encountered the same issue. The @Bing-su solution fixed this issue. Thanks a lot. Could @Bing-su make a PR to fix this?
This appears to be fixed in the latest pull be1596ce30b1ead6998da0c62003003dcce5eb2c. Not sure if I'm mistaken but I can't see my comments in the ui.py file so presume there is a fix in there as save now works. Can anyone else confirm this please and I'll close the bug?
I can say It is not fixed for img2img loopback and inpaint
Error completing request
Arguments: ('{"prompt": "masterpiece, best quality, 1girl, blonde hair, hair between eyes, church, praying.", "all_prompts": ["masterpiece, best quality, 1girl, blonde hair, hair between eyes, church, praying."], "negative_prompt": "gif artifacts, jpeg artifacts, aliasing, bleed through, crease, blurry, censored, anatomical nonsense, bad anatomy, bad feet, bad hands, bad proportions, gigantic breasts, huge breasts, large breasts, medium breasts, furry, bald, medium hair, short hair, very short hair", "seed": 3527571376, "all_seeds": [3527571376], "subseed": -1, "all_subseeds": [-1], "subseed_strength": 0, "width": 512, "height": 512, "sampler_index": 0, "sampler": "Euler a", "cfg_scale": 7, "steps": 20, "batch_size": 1, "restore_faces": false, "face_restoration_model": null, "sd_model_hash": "e6e8e1fc", "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, 1girl, blonde hair, hair between eyes, church, praying.\\nNegative prompt: gif artifacts, jpeg artifacts, aliasing, bleed through, crease, blurry, censored, anatomical nonsense, bad anatomy, bad feet, bad hands, bad proportions, gigantic breasts, huge breasts, large breasts, medium breasts, furry, bald, medium hair, short hair, very short hair\\nSteps: 20, Sampler: Euler a, CFG scale: 7, Seed: 3527571376, Size: 512x512, Model hash: e6e8e1fc, Denoising strength: 0.75, Clip skip: 2, ENSD: 31337, Denoising strength change factor: 1"], "styles": ["None", "None"], "job_timestamp": "20221015152832", "clip_skip": 2}', [{'name': 'D:\\ceche\\tmp8dl5b9mp\\tmpvygnjfh0.png', 'data': 'file=D:\\ceche\\tmp8dl5b9mp\\tmpvygnjfh0.png', 'is_file': True}, {'name': 'D:\\ceche\\tmp8dl5b9mp\\tmpgjue99_z.png', 'data': 'file=D:\\ceche\\tmp8dl5b9mp\\tmpgjue99_z.png', 'is_file': True}, {'name': 'D:\\ceche\\tmp8dl5b9mp\\tmp_rw3wzuz.png', 'data': 'file=D:\\ceche\\tmp8dl5b9mp\\tmp_rw3wzuz.png', 'is_file': True}, {'name': 'D:\\ceche\\tmp8dl5b9mp\\tmpsoc_9br3.png', 'data': 'file=D:\\ceche\\tmp8dl5b9mp\\tmpsoc_9br3.png', 'is_file': True}, {'name': 'D:\\ceche\\tmp8dl5b9mp\\tmp6ji7zhjh.png', 'data': 'file=D:\\ceche\\tmp8dl5b9mp\\tmp6ji7zhjh.png', 'is_file': True}], False, 1) {}
Traceback (most recent call last):
File "D:\AI\stable-diffusion-webui naifu\modules\ui.py", line 212, in f
res = list(func(*args, **kwargs))
File "D:\AI\stable-diffusion-webui naifu\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 "D:\AI\stable-diffusion-webui naifu\venv\lib\site-packages\gradio\routes.py", line 275, in run_predict
output = await app.blocks.process_api(
File "D:\AI\stable-diffusion-webui naifu\venv\lib\site-packages\gradio\blocks.py", line 791, in process_api
predictions = self.postprocess_data(fn_index, result["prediction"], state)
File "D:\AI\stable-diffusion-webui naifu\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
This appears to be fixed in the latest pull be1596c. Not sure if I'm mistaken but I can't see my comments in the ui.py file so presume there is a fix in there as save now works. Can anyone else confirm this please and I'll close the bug?
I just tried the new version and I no longer encounter the save issues. I think this can be closed.
I can say It is not fixed for img2img loopback and inpaint
Error completing request Arguments: ('{"prompt": "masterpiece, best quality, 1girl, blonde hair, hair between eyes, church, praying.", "all_prompts": ["masterpiece, best quality, 1girl, blonde hair, hair between eyes, church, praying."], "negative_prompt": "gif artifacts, jpeg artifacts, aliasing, bleed through, crease, blurry, censored, anatomical nonsense, bad anatomy, bad feet, bad hands, bad proportions, gigantic breasts, huge breasts, large breasts, medium breasts, furry, bald, medium hair, short hair, very short hair", "seed": 3527571376, "all_seeds": [3527571376], "subseed": -1, "all_subseeds": [-1], "subseed_strength": 0, "width": 512, "height": 512, "sampler_index": 0, "sampler": "Euler a", "cfg_scale": 7, "steps": 20, "batch_size": 1, "restore_faces": false, "face_restoration_model": null, "sd_model_hash": "e6e8e1fc", "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, 1girl, blonde hair, hair between eyes, church, praying.\\nNegative prompt: gif artifacts, jpeg artifacts, aliasing, bleed through, crease, blurry, censored, anatomical nonsense, bad anatomy, bad feet, bad hands, bad proportions, gigantic breasts, huge breasts, large breasts, medium breasts, furry, bald, medium hair, short hair, very short hair\\nSteps: 20, Sampler: Euler a, CFG scale: 7, Seed: 3527571376, Size: 512x512, Model hash: e6e8e1fc, Denoising strength: 0.75, Clip skip: 2, ENSD: 31337, Denoising strength change factor: 1"], "styles": ["None", "None"], "job_timestamp": "20221015152832", "clip_skip": 2}', [{'name': 'D:\\ceche\\tmp8dl5b9mp\\tmpvygnjfh0.png', 'data': 'file=D:\\ceche\\tmp8dl5b9mp\\tmpvygnjfh0.png', 'is_file': True}, {'name': 'D:\\ceche\\tmp8dl5b9mp\\tmpgjue99_z.png', 'data': 'file=D:\\ceche\\tmp8dl5b9mp\\tmpgjue99_z.png', 'is_file': True}, {'name': 'D:\\ceche\\tmp8dl5b9mp\\tmp_rw3wzuz.png', 'data': 'file=D:\\ceche\\tmp8dl5b9mp\\tmp_rw3wzuz.png', 'is_file': True}, {'name': 'D:\\ceche\\tmp8dl5b9mp\\tmpsoc_9br3.png', 'data': 'file=D:\\ceche\\tmp8dl5b9mp\\tmpsoc_9br3.png', 'is_file': True}, {'name': 'D:\\ceche\\tmp8dl5b9mp\\tmp6ji7zhjh.png', 'data': 'file=D:\\ceche\\tmp8dl5b9mp\\tmp6ji7zhjh.png', 'is_file': True}], False, 1) {} Traceback (most recent call last): File "D:\AI\stable-diffusion-webui naifu\modules\ui.py", line 212, in f res = list(func(*args, **kwargs)) File "D:\AI\stable-diffusion-webui naifu\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 "D:\AI\stable-diffusion-webui naifu\venv\lib\site-packages\gradio\routes.py", line 275, in run_predict output = await app.blocks.process_api( File "D:\AI\stable-diffusion-webui naifu\venv\lib\site-packages\gradio\blocks.py", line 791, in process_api predictions = self.postprocess_data(fn_index, result["prediction"], state) File "D:\AI\stable-diffusion-webui naifu\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
im going to make another issue so you can close this one.
Works for me now and another person. Different bug being opened (see last comment above)