internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
Fix faces using GFPGAN + high batch count tends to fail 6GB VRAM
6GB is already on a knife's edge, and this seems to push it over. However it doesn't do it every single time, and I have not seen it happen when using batch count 1, even when hitting submit repeatedly.

RuntimeError: CUDA out of memory. Tried to allocate 1024.00 MiB (GPU 0; 6.00 GiB total capacity; 3.30 GiB already allocated; 0 bytes free; 4.60 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


Discussion:
so just rename gfpgan folder and its solved

Resolving patch:
diff --git a/webui.py b/webui.py
--- a/webui.py
+++ b/webui.py
@@ -678,6 +678,7 @@ def infotext():
                     x_sample = x_sample.astype(np.uint8)
 
                     if use_GFPGAN and GFPGAN is not None:
+                        torch_gc()
                         cropped_faces, restored_faces, restored_img = GFPGAN.enhance(x_sample, has_aligned=False, only_center_face=False, paste_back=True)
                         x_sample = restored_img
 


Test patch:
Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
FileNotFoundError after new update
Getting a FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\admin\\stable-diffusion-webui\\scripts' after the new update. 

Not exactly good at all the coding stuff, using it just fine yesterday but I downloaded the repo instead of git clone, for the sake of easier update I started a new installation by git cloning into user folder and the installation went well but ran into this while launching through webui.py.

Python 3.10.6
venv C:\Users\admin\stable-diffusion-webui\venv\Scripts\Python.exe
Launching webui.py...
Loading model from C:\Users\admin\stable-diffusion-webui\model.ckpt
Global Step: 470000
LatentDiffusion: Running in eps-prediction mode
DiffusionWrapper has 859.52 M params.
making attention of type 'vanilla' with 512 in_channels
Working with z of shape (1, 4, 32, 32) = 4096 dimensions.
making attention of type 'vanilla' with 512 in_channels
Traceback (most recent call last):
  File "C:\Users\admin\stable-diffusion-webui\webui.py", line 135, in <module>
    modules.scripts.load_scripts(os.path.join(script_path, "scripts"))
  File "C:\Users\admin\stable-diffusion-webui\modules\scripts.py", line 32, in load_scripts
    for filename in os.listdir(basedir):
FileNotFoundError: [WinError 3] The system cannot find the path specified: 'C:\\Users\\admin\\stable-diffusion-webui\\scripts'


Discussion:
Happens to me now too.

Resolving patch:
diff --git a/modules/scripts.py b/modules/scripts.py
--- a/modules/scripts.py
+++ b/modules/scripts.py
@@ -29,6 +29,9 @@ def describe(self):
 
 
 def load_scripts(basedir):
+    if not os.path.exists(basedir):
+        return
+
     for filename in os.listdir(basedir):
         path = os.path.join(basedir, filename)
 


Test patch:
Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
Error in extras tab when resizing images
**Describe the bug**
Get error "AttributeError: 'int' object has no attribute 'encode'" on trying to upscale an image in the "extras" tab. 

**To Reproduce**
1. Go to 'extras
2. Click on lanczos, upload image, and press generate
3. See error on the right

**Expected behavior**
No error

**Screenshots**
![Screen Shot 2022-09-12 at 8 35 53 PM](https://user-images.githubusercontent.com/760865/189782451-411f6374-3220-405f-a1bb-ff4caac1ac68.png)

**Desktop (please complete the following information):**
 - OS: MacOS
 - Browser: Safari
 - Commit revision: 19a817d97dad1b2ce58e70cadc35ccba5cf1130e

**Additional context**
Serving from a linux box.



Discussion:
Same error. Same steps to reproduce.
OS: Windows 10
Browser: Chrome
Commit revision: [fa8be8a](https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/fa8be8acd62894bfc96da985326fda3208266468)
Agree, not only lanczos is broken, other upscalers not working as well

UPD: it is not working when you manually upload an image from PC, but working if image is provided by pressing "Send to extras" button

UPD2: I also got a bit different error

`AttributeError: 'tuple' object has no attribute 'encode'`

OS: Windows 10
Browser: Chrome
Commit revision: [fa8be8a](https://github.com/AUTOMATIC1111/stable-diffusion-webui/commit/fa8be8acd62894bfc96da985326fda3208266468)
same issue

w11, firefox

Resolving patch:
diff --git a/modules/images.py b/modules/images.py
--- a/modules/images.py
+++ b/modules/images.py
@@ -299,7 +299,7 @@ def save_image(image, path, basename, seed=None, prompt=None, extension='png', i
 
         if existing_info is not None:
             for k, v in existing_info.items():
-                pnginfo.add_text(k, v)
+                pnginfo.add_text(k, str(v))
 
         pnginfo.add_text(pnginfo_section_name, info)
     else:


Test patch:
Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
[Feature Request] Automatic link opening
A parameter that allows you to automatically open a UI link in the browser would be very convenient!


Discussion:

Resolving patch:
diff --git a/modules/shared.py b/modules/shared.py
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -49,6 +49,7 @@
 parser.add_argument("--gradio-auth", type=str, help='set gradio authentication like "username:password"; or comma-delimit multiple like "u1:p1,u2:p2,u3:p3"', default=None)
 parser.add_argument("--opt-channelslast", action='store_true', help="change memory type for stable diffusion to channels last")
 parser.add_argument("--styles-file", type=str, help="filename to use for styles", default=os.path.join(script_path, 'styles.csv'))
+parser.add_argument("--autolaunch", action=argparse.BooleanOptionalAction, help="open the webui URL in the system's default browser upon launch", default=False)
 cmd_opts = parser.parse_args()
 
 if cmd_opts.opt_split_attention:
diff --git a/webui.py b/webui.py
--- a/webui.py
+++ b/webui.py
@@ -89,6 +89,7 @@ def sigint_handler(sig, frame):
         server_port=cmd_opts.port,
         debug=cmd_opts.gradio_debug,
         auth=[tuple(cred.split(':')) for cred in cmd_opts.gradio_auth.strip('"').split(',')] if cmd_opts.gradio_auth else None,
+        inbrowser=cmd_opts.autolaunch,
     )
 
 


Test patch:
Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
Images being cleared on dragover
With 9035afb, dragging over an image will trigger the reset of that image. I don't find that a logical UI behaviour from a UX point of view. I might accidentally drag something over the browser window and involuntarily lose the current image. 

@trufty, would you mind explaining why that change was made?
If it was merely to fix the issue that in the PNG Info tab the info was not updated when replacing the image via paste or drop, I have already prepared a solution for that without clearing the image on dragover. In that case I'd make a PR that reverses that change and implements the (in my view) better fix for that issue.


Discussion:

Resolving patch:
diff --git a/modules/ui.py b/modules/ui.py
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -797,7 +797,7 @@ def apply_mode(mode, uploadmask):
     pnginfo_interface = gr.Interface(
         wrap_gradio_call(run_pnginfo),
         inputs=[
-            gr.Image(label="Source", source="upload", interactive=True, type="pil"),
+            gr.Image(elem_id="pnginfo_image", label="Source", source="upload", interactive=True, type="pil"),
         ],
         outputs=[
             gr.HTML(),


Test patch:
Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
Generate button doesn't change to Interrupt button when "show progressbar" is disabled in settings.
**Describe the bug**
With "show progressbar" off in settings, the Generate button doesn't change when generation begins and interrupt doesn't work.

With "show progressbar" on in settings, the Generate button changes to the Interrupt button and works as expected.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to Settings tab
2. Uncheck "show progressbar"
3. Go to txt2img tab.
4. Click Generate button
5. Note that Generate button doesn't change to Interrupt button, leaving user with no way to interrupt generation.

**Desktop (please complete the following information):**
 - OS: Windows 10
 - Browser Firefox
 - Commit revision a213d3a21c9e37297fdcb2c2b48bd24290a479cf





Discussion:

Resolving patch:
diff --git a/modules/ui.py b/modules/ui.py
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -200,7 +200,7 @@ def check_progress_call():
         else:
             preview_visibility = gr_show(True)
 
-    return f"<span style='display: none'>{time.time()}</span><p>{progressbar}</p>", preview_visibility, image
+    return f"<span id='progressSpan' style='display: none'>{time.time()}</span><p>{progressbar}</p>", preview_visibility, image
 
 
 def check_progress_call_initial():


Test patch:
Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
Checkpoint Merger - FileNotFoundError: [Errno 2] No such file or directory:
When using custom model folder: COMMANDLINE_ARGS=--ckpt-dir "d:\external\models\" the checkpoint merger can't find the models

FileNotFoundError: [Errno 2] No such file or directory: 'models/wd-v1-2-full-ema.ckpt'

**To Reproduce**
Steps to reproduce the behavior:
1. set  COMMANDLINE_ARGS=--ckpt-dir  "d:\external\models"
2. checkpint merger tab
3. select models it found in the custom folder
4. click run

**Expected behavior**
Would expect that since it knows where the models are, that it would continue to use that folder

Checkpoint Merger - FileNotFoundError: [Errno 2] No such file or directory:
When using custom model folder: COMMANDLINE_ARGS=--ckpt-dir "d:\external\models\" the checkpoint merger can't find the models

FileNotFoundError: [Errno 2] No such file or directory: 'models/wd-v1-2-full-ema.ckpt'

**To Reproduce**
Steps to reproduce the behavior:
1. set  COMMANDLINE_ARGS=--ckpt-dir  "d:\external\models"
2. checkpint merger tab
3. select models it found in the custom folder
4. click run

**Expected behavior**
Would expect that since it knows where the models are, that it would continue to use that folder



Discussion:
It also doesn't support merging models in subdirectories, it can read them but then fails on saving after the merge.
So it fails to read the models from the checkpoint directory; I imagine it also fails to save to that directory?
It also doesn't support merging models in subdirectories, it can read them but then fails on saving after the merge.
So it fails to read the models from the checkpoint directory; I imagine it also fails to save to that directory?

Resolving patch:
diff --git a/modules/ui.py b/modules/ui.py
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -869,7 +869,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger):
     with gr.Blocks() as modelmerger_interface:
         with gr.Row().style(equal_height=False):
             with gr.Column(variant='panel'):
-                gr.HTML(value="<p>A merger of the two checkpoints will be generated in your <b>/models</b> directory.</p>")
+                gr.HTML(value="<p>A merger of the two checkpoints will be generated in your <b>checkpoint</b> directory.</p>")
                 
                 with gr.Row():
                     ckpt_name_list = sorted([x.title for x in modules.sd_models.checkpoints_list.values()])


Test patch:
Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
"Save" button always saves to .png, ignoring settings
**Describe the bug**
When you press "Save", the image outputted to /log/ is always in png format, no matter what output format is selected in settings. The outputted images are properly saved to jpg, though. But in order for the "save" button to be useful, it should use the same format.
"Save" button always saves to .png, ignoring settings
**Describe the bug**
When you press "Save", the image outputted to /log/ is always in png format, no matter what output format is selected in settings. The outputted images are properly saved to jpg, though. But in order for the "save" button to be useful, it should use the same format.


Discussion:

Resolving patch:
diff --git a/modules/ui.py b/modules/ui.py
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -13,6 +13,7 @@
 import numpy as np
 import torch
 from PIL import Image, PngImagePlugin
+import piexif
 
 import gradio as gr
 import gradio.utils
@@ -111,18 +112,26 @@ def save_files(js_data, images, index):
             writer.writerow(["prompt", "seed", "width", "height", "sampler", "cfgs", "steps", "filename", "negative_prompt"])
 
         filename_base = str(int(time.time() * 1000))
+        extension = opts.samples_format.lower()
         for i, filedata in enumerate(images):
-            filename = filename_base + ("" if len(images) == 1 else "-" + str(i + 1)) + ".png"
+            filename = filename_base + ("" if len(images) == 1 else "-" + str(i + 1)) + f".{extension}"
             filepath = os.path.join(opts.outdir_save, filename)
 
             if filedata.startswith("data:image/png;base64,"):
                 filedata = filedata[len("data:image/png;base64,"):]
 
-            pnginfo = PngImagePlugin.PngInfo()
-            pnginfo.add_text('parameters', infotexts[i])
-
             image = Image.open(io.BytesIO(base64.decodebytes(filedata.encode('utf-8'))))
-            image.save(filepath, quality=opts.jpeg_quality, pnginfo=pnginfo)
+            if opts.enable_pnginfo and extension == 'png':
+                pnginfo = PngImagePlugin.PngInfo()
+                pnginfo.add_text('parameters', infotexts[i])
+                image.save(filepath, pnginfo=pnginfo)
+            else:
+                image.save(filepath, quality=opts.jpeg_quality)
+
+            if opts.enable_pnginfo and extension in ("jpg", "jpeg", "webp"):
+                piexif.insert(piexif.dump({"Exif": {
+                    piexif.ExifIFD.UserComment: piexif.helper.UserComment.dump(infotexts[i], encoding="unicode")
+                }}), filepath)
 
             filenames.append(filename)
 


Test patch:
Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
New samplers are not showing up
I just updated my version to try out the new samplers but they are not showing up. I deleted repositories/k-diffusion as a test but they still dont show up.

Someone on reddit mentioned to do "source venv/bin/activate/" and then to do a pip uninstall k-diffusion, but I have no idea what it means.

How can I get the new samplers to show up in the UI?

Edit: They dont show up in the img2img Tab


Discussion:
That isn't actually a bug, they were not able to get them working with img2img so, much like PLMS, they removed them from the img2img menu.
I have the same Issue, i don't see them on ANY of the tabs.
Edit: Uninstalling the old K-diffusion from the venv manually fixed it for me.

Resolving patch:
diff --git a/modules/sd_samplers.py b/modules/sd_samplers.py
--- a/modules/sd_samplers.py
+++ b/modules/sd_samplers.py
@@ -4,7 +4,8 @@
 import tqdm
 from PIL import Image
 import inspect
-
+from modules.paths import paths
+sys.path.insert(0, paths["k_diffusion"])
 import k_diffusion.sampling
 import ldm.models.diffusion.ddim
 import ldm.models.diffusion.plms


Test patch:
Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
Display time taken in minutes when over 60 seconds
**Is your feature request related to a problem? Please describe.**
I am always investigating how my parameters relate to the performance for a run so I can time things better. If I'm stepping off the computer for 15 minutes, it's useful for me to be better understanding how many steps and batch count I can run in that time-frame.

**Describe the solution you'd like**
Display minutes when over 60s, e.g. `Time taken: 3m 35s` instead of `Time taken: 215.08s`

**Describe alternatives you've considered**

**Additional context**



Discussion:

Resolving patch:
diff --git a/modules/ui.py b/modules/ui.py
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -196,6 +196,11 @@ def f(*args, extra_outputs_array=extra_outputs, **kwargs):
             res = extra_outputs_array + [f"<div class='error'>{plaintext_to_html(type(e).__name__+': '+str(e))}</div>"]
 
         elapsed = time.perf_counter() - t
+        elapsed_m = int(elapsed // 60)
+        elapsed_s = elapsed % 60
+        elapsed_text = f"{elapsed_s:.2f}s"
+        if (elapsed_m > 0):
+            elapsed_text = f"{elapsed_m}m "+elapsed_text
 
         if run_memmon:
             mem_stats = {k: -(v//-(1024*1024)) for k, v in shared.mem_mon.stop().items()}
@@ -210,7 +215,7 @@ def f(*args, extra_outputs_array=extra_outputs, **kwargs):
             vram_html = ''
 
         # last item is always HTML
-        res[-1] += f"<div class='performance'><p class='time'>Time taken: <wbr>{elapsed:.2f}s</p>{vram_html}</div>"
+        res[-1] += f"<div class='performance'><p class='time'>Time taken: <wbr>{elapsed_text}</p>{vram_html}</div>"
 
         shared.state.interrupted = False
         shared.state.job_count = 0


Test patch:
Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
Save feature fails until output directories created manually
**Describe the bug**
Save feature of txt2img panel does not work until output directories are created manually

**To Reproduce**
Steps to reproduce the behavior:
1. Check out a clean copy of the project add the model file and launch it via `webui.bat`, wait for downloads to complete
2. Load the app in the browser
3. Focus the `txt2img` tab focused (should already be by default)
4. Enter any prompt and click the `Generate` button
5. Wait for the images to complete
6. Click the `Save` button below the generated images

**Expected behavior**
1. Images should be saved to `log/images`
2. CSV should be created/updated with info about the images

**Actual behavior**
1. Save info panel displays a red `Error` indicator
2. In the server output, save fails due to the output directory not existing

    Log Output:
```bash
Traceback (most recent call last):
  File "<PATH>\modules\ui.py", line 176, in f
    res = list(func(*args, **kwargs))
  File "<PATH>\modules\ui.py", line 128, in save_files
    with open(os.path.join(opts.outdir_save, "log.csv"), "a", encoding="utf8", newline='') as file:
FileNotFoundError: [Errno 2] No such file or directory: 'log/images\\log.csv'

Traceback (most recent call last):
  File "<PATH>\venv\lib\site-packages\gradio\routes.py", line 273, in run_predict
    output = await app.blocks.process_api(
  File "<PATH>\venv\lib\site-packages\gradio\blocks.py", line 746, in process_api
    predictions = self.postprocess_data(fn_index, result["prediction"], state)
  File "<PATH>\venv\lib\site-packages\gradio\blocks.py", line 700, 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
 - Browser: Chrome
 - Commit revision: 42bf5fa3256bff5e4640e5a626e750d4e49e01e1

**Additional context**
After manually creating the `log` and `images` folders, save works as expected



Discussion:

Resolving patch:
diff --git a/modules/ui.py b/modules/ui.py
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -131,6 +131,8 @@ def __init__(self, d=None):
         images = [images[index]]
         start_index = index
 
+    os.makedirs(opts.outdir_save, exist_ok=True)
+
     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)


Test patch:
Repository: AUTOMATIC1111/stable-diffusion-webui

Issue:
Progress bar percentage is broken
**Describe the bug**
Progress bar  finishes on 65-80%, image processing bar and total progress bar are have different steps amount.
I've already seen this issue https://github.com/AUTOMATIC1111/stable-diffusion-webui/issues/3093, I think it's related to this, but it covers a slightly different problem.

![image](https://user-images.githubusercontent.com/38957619/196678705-5599f336-9e38-41e0-b7ce-dabc7188e8c0.png)

Even with "do exactly the amount of steps the slider specifies" setting turned on it still shows strange percentage, for some reason it doubles the amount of steps:

![image](https://user-images.githubusercontent.com/38957619/196679701-7b2a251a-23c0-4204-ad03-8ff2a106a8d7.png)

Also, It doesn't work SD upscaling too:

![image](https://user-images.githubusercontent.com/38957619/196681622-e5f0f3ee-3853-45b1-a6a7-26504346f400.png)

**To Reproduce**
Steps to reproduce the behavior:
1. Go to img2img tab
2. Select an image
3. Press Generate button
4. See incorrect percentage display on progress bar

P.S. Try to use SD upscale or turn on "do exactly the amount of steps the slider specifies" setting to see that problem is still appears.

**Expected behavior**
Total progress bar should have the same amount of steps as sum of all steps for each image processing

**Desktop (please complete the following information):**
 - OS: Windows
 - Browser: Google Chrome
 - Commit revision: f894dd552f68bea27476f1f360ab8e79f3a65b4f


Discussion:

Resolving patch:
diff --git a/modules/sd_samplers.py b/modules/sd_samplers.py
--- a/modules/sd_samplers.py
+++ b/modules/sd_samplers.py
@@ -219,7 +219,7 @@ def sample_img2img(self, p, x, noise, conditioning, unconditional_conditioning,
             unconditional_conditioning = {"c_concat": [image_conditioning], "c_crossattn": [unconditional_conditioning]}
             
             
-        samples = self.launch_sampling(steps, lambda: self.sampler.decode(x1, conditioning, t_enc, unconditional_guidance_scale=p.cfg_scale, unconditional_conditioning=unconditional_conditioning))
+        samples = self.launch_sampling(t_enc + 1, lambda: self.sampler.decode(x1, conditioning, t_enc, unconditional_guidance_scale=p.cfg_scale, unconditional_conditioning=unconditional_conditioning))
 
         return samples
 
@@ -420,7 +420,7 @@ def sample_img2img(self, p, x, noise, conditioning, unconditional_conditioning,
         self.model_wrap_cfg.init_latent = x
         self.last_latent = x
 
-        samples = self.launch_sampling(steps, lambda: self.func(self.model_wrap_cfg, xi, extra_args={
+        samples = self.launch_sampling(t_enc + 1, lambda: self.func(self.model_wrap_cfg, xi, extra_args={
             'cond': conditioning, 
             'image_cond': image_conditioning, 
             'uncond': unconditional_conditioning, 


Test patch: