AUTOMATIC1111 / stable-diffusion-webui

Stable Diffusion web UI
GNU Affero General Public License v3.0
140.3k stars 26.55k forks source link

[Bug]: #13645

Closed dhmiller closed 11 months ago

dhmiller commented 11 months ago

Is there an existing issue for this?

What happened?

In Img2img Batch mode, all files were being created with the same file name, so when written to disk, each overwrote the previous. I had to change seed to "iterate seed every line" as a workaround.

Steps to reproduce the problem

  1. Go to Image2Image Batch.
  2. Specify input and output folder and all needed info - press Generate.
  3. Files will be created with the exact name and each will overwrite any existing file in the output folder, resulting in only one file in the output folder at the end of the batch run.

What should have happened?

A new file name should be created for each newly generated file.

Sysinfo

sysinfo-2023-10-14-23-54.txt

What browsers do you use to access the UI ?

Microsoft Edge

Console logs

*** Error loading script: dream_artist_main.py
    Traceback (most recent call last):
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 382, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 10, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/DreamArtist-sd-webui-extension/scripts/dream_artist_main.py", line 10, in <module>
        from webui import wrap_gradio_gpu_call
    ImportError: cannot import name 'wrap_gradio_gpu_call' from 'webui' (/content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py)

---
*** Error loading script: deforum.py
    Traceback (most recent call last):
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 382, in load_scripts
        script_module = script_loading.load_module(scriptfile.path)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/script_loading.py", line 10, in load_module
        module_spec.loader.exec_module(module)
      File "<frozen importlib._bootstrap_external>", line 883, in exec_module
      File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/deforum-for-automatic1111-webui/scripts/deforum.py", line 41, in <module>
        from webui import wrap_gradio_gpu_call
    ImportError: cannot import name 'wrap_gradio_gpu_call' from 'webui' (/content/gdrive/MyDrive/sd/stable-diffusion-webui/webui.py)

---
2023-10-14 23:28:34,502 - ControlNet - INFO - ControlNet v1.1.410
ControlNet preprocessor location: /content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/annotator/downloads
2023-10-14 23:28:35,807 - ControlNet - INFO - ControlNet v1.1.410
Loading weights [31e35c80fc] from /content/gdrive/MyDrive/sd/stable-diffusion-webui/models/Stable-diffusion/sd_xl_base_1.0.safetensors
Running on public URL: https://e022a073d41f625cee.gradio.live
✔ Connected
Startup time: 31.4s (launcher: 0.2s, import torch: 12.4s, import gradio: 1.5s, setup paths: 1.8s, initialize shared: 0.5s, other imports: 2.3s, setup codeformer: 0.2s, load scripts: 4.9s, initialize extra networks: 0.1s, create ui: 2.4s, gradio launch: 4.7s, add APIs: 0.2s).
Creating model from config: /content/gdrive/MyDrive/sd/stablediffusion/generative-models/configs/inference/sd_xl_base.yaml
Applying attention optimization: xformers... done.
Model loaded in 61.1s (load weights from disk: 7.5s, create model: 0.7s, apply weights to model: 49.4s, calculate empty prompt: 3.3s).
Will process 70 images, creating 1 new images for each.
Will process 39 lines in 39 jobs.
*** Error completing request
*** Arguments: ('task(92942ydxoeto8w6)', 5, '', "animals, face, faces, woman's face, human, body parts, letters, text, initials, artist names, ugly, stupid, landscapes, buildings, towns, houses, geometric shapes, spheres, circles, balls, ", [], None, None, None, None, None, None, None, 65, 'DPM++ 2S a Karras', 4, 0, 1, 1, 1, 12, 1.5, 0.65, 0, 1280, 1920, 1, 0, 0, 32, 0, '/content/gdrive/MyDrive/input_images/crystals', '/content/gdrive/MyDrive/output/crystals', '', [], False, [], '', <gradio.routes.Request object at 0x791cc27743a0>, 6, False, '', 0.8, -1, False, -1, 0, 0, 0, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x791caba99660>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x791cab499ba0>, <scripts.controlnet_ui.controlnet_ui_group.UiControlNetUnit object at 0x791cab57d840>, '* `CFG Scale` should be 2 or lower.', True, True, '', '', True, 50, True, 1, 0, False, 4, 0.5, 'Linear', 'None', '<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, True, False, '\n{\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted by by daniel merriam and naoto hattori,    ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Duy Huuhn and Wilfredo Lam,    ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Oscar Fischinger and Daniel Merriam,    ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Max Ernst and Pousette-Dart     ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Oscar Fischinger   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Philip Guston and Wilfredo Lam    ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by James Ensor and Naoto Hattori   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Wilfredo Lam     ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Yves Tanguey and Naoto Hattori   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Archipenko and Daniel Merriam  ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Yves Tanguey and Wilfredo Lam   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Roberto Matta and Pousette-Dart     ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Philip Guston and Pousette-Dart ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Vladimir Kush and Wilfredo Lam   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Hannah Yatta and BArbara Takenaga  ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Olbinski and Vladimir Kush   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Hannah Yatta and ellen jewett  ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Olbinski and roberto matta   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by  pousette dart   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Archipenko and Roberto Matta  ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Yves Tanguey and Wilfredo Lam   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Roberto Matta and Pousette-Dart     ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Jasca Yerka and Olbinski  ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Duy Huuhn and Wilfredo Lam   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Hannah Yatta and BArbara Takenaga  ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Olbinski and Vladimir Kush   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Hannah Yatta and ellen jewett  ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Olbinski and roberto matta   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by naoto hattori and pousette dart   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Archipenko and Daniel Merriam  ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Yves Tanguey and Wilfredo Lam   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Roberto Matta and Pousette-Dart     ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Daniel Merriam and Yves Tanguey  ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Vladimir Kush and Duy Huuh   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Hannah Yatta and Helen Frankenthaler ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by Olbinski and Vladimir Kush   ",\n"a surreal  abstract  painting, something that even doesn\'t exist, mythical  energy, molecular, ORGANIC textures, iridescent and luminescent      painted  by M. C. Escher and ellen jewett  "\n}', '<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, False, None, None, False, None, None, False, None, None, False, 50) {}
    Traceback (most recent call last):
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 57, in f
        res = list(func(*args, **kwargs))
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/call_queue.py", line 36, in f
        res = func(*args, **kwargs)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/img2img.py", line 202, 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 "/content/gdrive/MyDrive/sd/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 "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/img2img.py", line 107, in process_batch
        proc = modules.scripts.scripts_img2img.run(p, *args)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/scripts.py", line 601, in run
        processed = script.run(p, *script_args)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/scripts/prompts_from_file.py", line 161, in run
        proc = process_images(copy_p)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 732, in process_images
        res = process_images_inner(p)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/extensions/sd-webui-controlnet/scripts/batch_hijack.py", line 42, in processing_process_images_hijack
        return getattr(processing, '__controlnet_original_process_images_inner')(p, *args, **kwargs)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 803, in process_images_inner
        p.init(p.all_prompts, p.all_seeds, p.all_subseeds)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/processing.py", line 1496, in init
        self.init_latent = images_tensor_to_samples(image, approximation_indexes.get(opts.sd_vae_encode_method), self.sd_model)
      File "/content/gdrive/MyDrive/sd/stable-diffusion-webui/modules/sd_samplers_common.py", line 110, in images_tensor_to_samples
        x_latent = model.get_first_stage_encoding(model.encode_first_stage(image))
      File "/usr/local/lib/python3.10/dist-packages/torch/utils/_contextlib.py", line 115, in decorate_context
        return func(*args, **kwargs)
      File "/content/gdrive/MyDrive/sd/stablediffusion/generative-models/sgm/models/diffusion.py", line 127, in encode_first_stage
        z = self.first_stage_model.encode(x)
      File "/content/gdrive/MyDrive/sd/stablediffusion/generative-models/sgm/models/autoencoder.py", line 321, in encode
        return super().encode(x).sample()
      File "/content/gdrive/MyDrive/sd/stablediffusion/generative-models/sgm/models/autoencoder.py", line 308, in encode
        h = self.encoder(x)
      File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
        return forward_call(*args, **kwargs)
      File "/content/gdrive/MyDrive/sd/stablediffusion/generative-models/sgm/modules/diffusionmodules/model.py", line 589, in forward
        h = self.mid.attn_1(h)
      File "/usr/local/lib/python3.10/dist-packages/torch/nn/modules/module.py", line 1501, in _call_impl
        return forward_call(*args, **kwargs)
      File "/content/gdrive/MyDrive/sd/stablediffusion/generative-models/sgm/modules/diffusionmodules/model.py", line 260, in forward
        h_ = self.attention(h_)
      File "/content/gdrive/MyDrive/sd/stablediffusion/generative-models/sgm/modules/diffusionmodules/model.py", line 238, in attention
        q, k, v = map(
      File "/content/gdrive/MyDrive/sd/stablediffusion/generative-models/sgm/modules/diffusionmodules/model.py", line 243, in <lambda>
        .contiguous(),
    torch.cuda.OutOfMemoryError: CUDA out of memory. Tried to allocate 76.00 MiB (GPU 0; 14.75 GiB total capacity; 13.16 GiB already allocated; 26.81 MiB free; 13.43 GiB reserved in total by PyTorch) If reserved memory is >> allocated memory try setting max_split_size_mb to avoid fragmentation.  See documentation for Memory Management and PYTORCH_CUDA_ALLOC_CONF

---
Will process 70 images, creating 1 new images for each.
Will process 39 lines in 39 jobs.
100% 43/43 [01:32<00:00,  2.15s/it]
100% 43/43 [01:28<00:00,  2.06s/it]
100% 43/43 [01:28<00:00,  2.06s/it]
100% 43/43 [01:29<00:00,  2.07s/it]
100% 43/43 [01:28<00:00,  2.06s/it]
100% 43/43 [01:29<00:00,  2.08s/it]
100% 43/43 [01:28<00:00,  2.07s/it]
100% 43/43 [01:29<00:00,  2.07s/it]
100% 43/43 [01:29<00:00,  2.07s/it]
100% 43/43 [01:28<00:00,  2.06s/it]
100% 43/43 [01:28<00:00,  2.07s/it]
100% 43/43 [01:29<00:00,  2.07s/it]
100% 43/43 [01:28<00:00,  2.07s/it]
100% 43/43 [01:28<00:00,  2.06s/it]
100% 43/43 [01:29<00:00,  2.07s/it]
 23% 10/43 [00:20<01:08,  2.09s/it]

Additional information

I got an initial OOM error, which can be seen in the CMD log, but changed the W/H values to mitigate that.

missionfloyd commented 11 months ago

Go to Settings > Saving Images / Grids, and enable Add number to filename when saving.

https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Images-Filename-Name-and-Subdirectory

dhmiller commented 11 months ago

Thanks very much. I had thought it would auto-add a number to the output file name to avoid overwriting the previous file - learned my lesson. Thanks again for your help. d.

On Sun, Oct 15, 2023 at 12:07 AM missionfloyd @.***> wrote:

Go to Settings > Saving Images / Grids, and enable Add number to filename when saving.

https://github.com/AUTOMATIC1111/stable-diffusion-webui/wiki/Custom-Images-Filename-Name-and-Subdirectory

— Reply to this email directly, view it on GitHub https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/13645#issuecomment-1763264347, or unsubscribe https://github.com/notifications/unsubscribe-auth/AK4TZPERKH3NXQV2HFPKBKLX7NOO3ANCNFSM6AAAAAA6ASP67E . You are receiving this because you authored the thread.Message ID: @.***>