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

Issue:
[Feature Request]:  Extra Networks cards size change
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What would your feature do ?

Extra Networks cards size change

I confirmed that there is a function to change to a thumbs rather than a card in the settings.
However, there is a problem that the size is too small when changed to thumbs
Can't add a function to change the card size in settings?


### Proposed workflow

1. Go to Settings tab -> Extra Networks -> Default view for Extra Networks

### Additional information

_No response_


Discussion:

Resolving patch:
diff --git a/modules/shared.py b/modules/shared.py
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -451,6 +451,8 @@ def list_samplers():
 options_templates.update(options_section(('extra_networks', "Extra Networks"), {
     "extra_networks_default_view": OptionInfo("cards", "Default view for Extra Networks", gr.Dropdown, {"choices": ["cards", "thumbs"]}),
     "extra_networks_default_multiplier": OptionInfo(1.0, "Multiplier for extra networks", gr.Slider, {"minimum": 0.0, "maximum": 1.0, "step": 0.01}),
+    "extra_networks_card_width": OptionInfo(0, "Card width for Extra Networks (px)"),
+    "extra_networks_card_height": OptionInfo(0, "Card height for Extra Networks (px)"),
     "extra_networks_add_text_separator": OptionInfo(" ", "Extra text to add before <...> when adding extra network to prompt"),
     "sd_hypernetwork": OptionInfo("None", "Add hypernetwork to prompt", gr.Dropdown, lambda: {"choices": [""] + [x for x in hypernetworks.keys()]}, refresh=reload_hypernetworks),
 }))
diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py
--- a/modules/ui_extra_networks.py
+++ b/modules/ui_extra_networks.py
@@ -147,13 +147,16 @@ def create_html_for_item(self, item, tabname):
         if onclick is None:
             onclick = '"' + html.escape(f"""return cardClicked({json.dumps(tabname)}, {item["prompt"]}, {"true" if self.allow_negative_prompt else "false"})""") + '"'
 
+        height = f"height: {shared.opts.extra_networks_card_height}px;" if shared.opts.extra_networks_card_height else ''
+        width = f"width: {shared.opts.extra_networks_card_width}px;" if shared.opts.extra_networks_card_width else ''
+        background_image = f"background-image: url(\"{html.escape(preview)}\");" if preview else ''
         metadata_button = ""
         metadata = item.get("metadata")
         if metadata:
             metadata_button = f"<div class='metadata-button' title='Show metadata' onclick='extraNetworksRequestMetadata({json.dumps(self.name)}, {json.dumps(item['name'])})'></div>"
 
         args = {
-            "preview_html": "style='background-image: url(\"" + html.escape(preview) + "\")'" if preview else '',
+            "style": f"'{height}{width}{background_image}'",
             "prompt": item.get("prompt", None),
             "tabname": json.dumps(tabname),
             "local_preview": json.dumps(item["local_preview"]),


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

Issue:
[Feature Request]: add support for lossless WebP as output format
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What would your feature do ?

Currently, WebP works for me if I set it in settings, but it's lossy WebP. Would be great to have an option for lossless WebP. Smaller file size than PNG, supported almost everywhere.

### Proposed workflow

Set file format for images & grids in options to webp to generate lossless WebP

### Additional information

_No response_


Discussion:

Resolving patch:
diff --git a/modules/images.py b/modules/images.py
--- a/modules/images.py
+++ b/modules/images.py
@@ -556,7 +556,7 @@ def _atomically_save_image(image_to_save, filename_without_extension, extension)
             elif image_to_save.mode == 'I;16':
                 image_to_save = image_to_save.point(lambda p: p * 0.0038910505836576).convert("RGB" if extension.lower() == ".webp" else "L")
 
-            image_to_save.save(temp_file_path, format=image_format, quality=opts.jpeg_quality)
+            image_to_save.save(temp_file_path, format=image_format, quality=opts.jpeg_quality, lossless=opts.webp_lossless)
 
             if opts.enable_pnginfo and info is not None:
                 exif_bytes = piexif.dump({
diff --git a/modules/shared.py b/modules/shared.py
--- a/modules/shared.py
+++ b/modules/shared.py
@@ -327,6 +327,7 @@ def list_samplers():
     "save_images_before_highres_fix": OptionInfo(False, "Save a copy of image before applying highres fix."),
     "save_images_before_color_correction": OptionInfo(False, "Save a copy of image before applying color correction to img2img results"),
     "jpeg_quality": OptionInfo(80, "Quality for saved jpeg images", gr.Slider, {"minimum": 1, "maximum": 100, "step": 1}),
+    "webp_lossless": OptionInfo(False, "Use lossless compression for webp images"),
     "export_for_4chan": OptionInfo(True, "If the saved image file size is above the limit, or its either width or height are above the limit, save a downscaled copy as JPG"),
     "img_downscale_threshold": OptionInfo(4.0, "File size limit for the above option, MB", gr.Number),
     "target_side_length": OptionInfo(4000, "Width/height limit for the above option, in pixels", gr.Number),


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

Issue:
[Bug]: Web shows the wrong result
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

After using txt2img many times, I found that the Result window after execution is often not refreshed or shows old results, so I have to open the output path to view the real results. This problem is more likely to occur when executing a new task after using interrupt or skip.

### Steps to reproduce the problem

1. Execute txt2img
2. Repeat multiple times with different inputs and configs
3. Observation results

### What should have happened?

Each execution displays the corresponding result.

### Commit where the problem happens

0cc0ee1bcb4c24a8c9715f66cede06601bfc00c8

### What platforms do you use to access the UI ?

Windows

### What browsers do you use to access the UI ?

Google Chrome

### Command Line Arguments

```Shell
--no-half-vae --skip-version-check
```


### List of extensions

No

### Console logs

```Shell
Without any warnings and errors.
```


### Additional information

_No response_


Discussion:
+1

Resolving patch:
diff --git a/modules/generation_parameters_copypaste.py b/modules/generation_parameters_copypaste.py
--- a/modules/generation_parameters_copypaste.py
+++ b/modules/generation_parameters_copypaste.py
@@ -59,6 +59,7 @@ def image_from_url_text(filedata):
         is_in_right_dir = ui_tempdir.check_tmp_file(shared.demo, filename)
         assert is_in_right_dir, 'trying to open image file outside of allowed directories'
 
+        filename = filename.rsplit('?', 1)[0]
         return Image.open(filename)
 
     if type(filedata) == list:
diff --git a/modules/ui_tempdir.py b/modules/ui_tempdir.py
--- a/modules/ui_tempdir.py
+++ b/modules/ui_tempdir.py
@@ -2,6 +2,7 @@
 import tempfile
 from collections import namedtuple
 from pathlib import Path
+from time import time
 
 import gradio as gr
 
@@ -34,6 +35,7 @@ def check_tmp_file(gradio, filename):
 def save_pil_to_file(pil_image, dir=None):
     already_saved_as = getattr(pil_image, 'already_saved_as', None)
     if already_saved_as and os.path.isfile(already_saved_as):
+        already_saved_as += f'?{int(time())}'
         register_tmp_file(shared.demo, already_saved_as)
 
         file_obj = Savedfile(already_saved_as)


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

Issue:
[Bug]: FileNotFoundError on broken symlinks
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

I am getting an uncaught `FileNotFound` Exception for symlinks that are broken.

### Steps to reproduce the problem

1. Have a symlink in `models/Lora`
2. Delete the file the link is pointing to

https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/39ec4f06ffb2c26e1298b2c5d80874dc3fd693ac/modules/hashes.py#L51

raises a `FileNotFound` exception. Either the webui relies on the directory listing implying that the files are accessible or there is an exists check somewhere which probably would succeed for broken symlinks, even when checking the mtime does not.

### What should have happened?

Probably the best way would be to just handle the exception and remove the file from the list. Possibly the console could print a warning.

### Commit where the problem happens

39ec4f06ffb2c26e1298b2c5d80874dc3fd693ac

### What Python version are you running on ?

Python 3.10.x

### Console logs

```Shell
...
  File "/usr/lib/python3.10/genericpath.py", line 55, in getmtime
    return os.stat(filename).st_mtime
FileNotFoundError: [Errno 2] No such file or directory: '/xxx/models/Lora/other/brokensymlink.safetensors'
```


Discussion:
Is... there some reason for not just removing the broken symlink?
Probably not, but the issue happens before you delete the symlink.

- Have a folder "mylora" somewhere
- Symlink things to "models/Lora" in the webui folder
- Rename "ghlv23.safetensors" to "githublogo_v23.safetensors" in "mylora"
- Start Webui and get an exception

Of course, the problem is solved by removing the symlink and restarting webui, but I think an unhandled exception is bug that should be fixed, even when it is triggered by an easy to resolve edge case.

Resolving patch:
diff --git a/extensions-builtin/Lora/lora.py b/extensions-builtin/Lora/lora.py
--- a/extensions-builtin/Lora/lora.py
+++ b/extensions-builtin/Lora/lora.py
@@ -448,7 +448,11 @@ def list_available_loras():
             continue
 
         name = os.path.splitext(os.path.basename(filename))[0]
-        entry = LoraOnDisk(name, filename)
+        try:
+            entry = LoraOnDisk(name, filename)
+        except OSError:  # should catch FileNotFoundError and PermissionError etc.
+            errors.report(f"Failed to load LoRA {name} from {filename}", exc_info=True)
+            continue
 
         available_loras[name] = entry
 


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

Issue:
[Feature Request]: Support for GIF preview images
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What would your feature do ?

Right now preview images are either jpg or png, but now you can download Civitai previews in GIF format that contain all metadata. It would be nice to support them in preview images. 

Also maybe support for webp images also. It seems to be used now also.

### Proposed workflow

1. Go to .... 
2. Press ....
3. ...


### Additional information

_No response_


Discussion:

Resolving patch:
diff --git a/modules/ui_extra_networks.py b/modules/ui_extra_networks.py
--- a/modules/ui_extra_networks.py
+++ b/modules/ui_extra_networks.py
@@ -30,8 +30,8 @@ def fetch_file(filename: str = ""):
         raise ValueError(f"File cannot be fetched: {filename}. Must be in one of directories registered by extra pages.")
 
     ext = os.path.splitext(filename)[1].lower()
-    if ext not in (".png", ".jpg", ".jpeg", ".webp"):
-        raise ValueError(f"File cannot be fetched: {filename}. Only png and jpg and webp.")
+    if ext not in (".png", ".jpg", ".jpeg", ".webp", ".gif"):
+        raise ValueError(f"File cannot be fetched: {filename}. Only png, jpg, webp, and gif.")
 
     # would profit from returning 304
     return FileResponse(filename, headers={"Accept-Ranges": "bytes"})


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

Issue:
"Send to" buttons don't set "Extras" checkbox when using a variation seed.
If a PNG created using a variation seed is loaded into the "PNG Info" tab, the "Variation seed strength" and "Denoising strength" options are displayed. When using the "Send to txt2img" or "Send to img2txt" options, the seed and denoising are set, but the "Extras" checkbox is not set so the variation seed settings aren't applied.

The same issue occurs if an image with a variation seed is created on the txt2img tab and the "Send to img2txt" option is used.

Commit hash: 45bf9a6264b3507473e02cc3f9aa36559f24aca2



Discussion:
Can confirm this also occurs when using anything else from the Extras tab. (scale seed in my case)
....and can confirm it also occurs for clip aestethics
Bumping this as it's actually still an issue.

Resolving patch:
diff --git a/modules/ui.py b/modules/ui.py
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -585,6 +585,7 @@ def create_ui():
                 (width, "Size-1"),
                 (height, "Size-2"),
                 (batch_size, "Batch size"),
+                (seed_checkbox, lambda d: "Variation seed" in d or "Seed resize from-1" in d),
                 (subseed, "Variation seed"),
                 (subseed_strength, "Variation seed strength"),
                 (seed_resize_from_w, "Seed resize from-1"),
@@ -972,6 +973,7 @@ def select_img2img_tab(tab):
                 (width, "Size-1"),
                 (height, "Size-2"),
                 (batch_size, "Batch size"),
+                (seed_checkbox, lambda d: "Variation seed" in d or "Seed resize from-1" in d),
                 (subseed, "Variation seed"),
                 (subseed_strength, "Variation seed strength"),
                 (seed_resize_from_w, "Seed resize from-1"),


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

Issue:
[Bug]: img2img -> txt2img (using pnginfo): conflict denoising with Hires.fix denoising
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

OS: Windows 11
Browser: Firefox Nightly

using pnginfo to send to txt2img activates hires.fix denoising from metadata saved by img2img (that it has denoising).

### Steps to reproduce the problem

1. Go to .... 
2. Press ....
3. ...


### What should have happened?

hires.fix must be turned off when sending from pnginfo to txt2img (if it was saved by img2img)

### Commit where the problem happens

dunno

### What platforms do you use to access UI ?

Windows

### What browsers do you use to access the UI ?

Mozilla Firefox

### Command Line Arguments

_No response_

### Additional information, context and logs

_No response_


Discussion:

Resolving patch:
diff --git a/modules/ui.py b/modules/ui.py
--- a/modules/ui.py
+++ b/modules/ui.py
@@ -591,8 +591,8 @@ def create_ui():
                 (seed_resize_from_h, "Seed resize from-2"),
                 (toprow.ui_styles.dropdown, lambda d: d["Styles array"] if isinstance(d.get("Styles array"), list) else gr.update()),
                 (denoising_strength, "Denoising strength"),
-                (enable_hr, lambda d: "Denoising strength" in d),
-                (hr_options, lambda d: gr.Row.update(visible="Denoising strength" in d)),
+                (enable_hr, lambda d: "Denoising strength" in d and ("Hires upscale" in d or "Hires upscaler" in d or "Hires resize-1" in d)),
+                (hr_options, lambda d: gr.Row.update(visible="Denoising strength" in d and ("Hires upscale" in d or "Hires upscaler" in d or "Hires resize-1" in d))),
                 (hr_scale, "Hires upscale"),
                 (hr_upscaler, "Hires upscaler"),
                 (hr_second_pass_steps, "Hires steps"),


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

Issue:
[Bug]: incorrect file path when prompt contains new line
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

prompt:
```
portrait of a woman, art by
Henry Asencio	
Anton Fadeev	
Artgerm
Bastien Lecouffe-Deharme	
Carne Griffiths	
Darek Zabrocki	
Patrice Murciano	
Russ Mills	
WLOP
Yoji Shinkawa	

```
error:
```
OSError: [Errno 22] Invalid argument: 'outputs/txt2img-images\\02357-757535083-portrait of a woman, art by_Henry Asencio\t_Anton Fadeev\t_Artgerm_Bastien Lecouffe-Deharme\t_Carne Griffiths\t_Darek Zabrocki\t_Patr.png'
```

### Steps to reproduce the problem

use prompt with new line symbol

### What should have happened?

The script should convert that to safe saving reading name

### Commit where the problem happens

98947d173e3f1667eba29c904f681047dea9de90

### What platforms do you use to access UI ?

Windows

### What browsers do you use to access the UI ?

Google Chrome

### Command Line Arguments

_No response_

### Additional information, context and logs

_No response_


Discussion:
Could not reproduce. More information would be appreciated.
Thank you for looking into it.
With new insight: it is not new line, it is '\t' tab symbol.
Basically possible only when pasting.

Resolving patch:
diff --git a/modules/images.py b/modules/images.py
--- a/modules/images.py
+++ b/modules/images.py
@@ -318,7 +318,7 @@ def resize(im, w, h):
     return res
 
 
-invalid_filename_chars = '<>:"/\\|?*\n'
+invalid_filename_chars = '<>:"/\\|?*\n\r\t'
 invalid_filename_prefix = ' '
 invalid_filename_postfix = ' .'
 re_nonletters = re.compile(r'[\s' + string.punctuation + ']+')


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

Issue:
[Feature Request]: Where is the save style button?
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What would your feature do ?

Is it possible to make the old implementation of save style as well?
Not being able to save the currently typed prompt is very troublesome.
Why do we have to open the edit screen and copy/paste the prompt?

### Proposed workflow

Restore old implementation of save styles button

### Additional information

_No response_


Discussion:

Resolving patch:
diff --git a/modules/ui_prompt_styles.py b/modules/ui_prompt_styles.py
--- a/modules/ui_prompt_styles.py
+++ b/modules/ui_prompt_styles.py
@@ -4,6 +4,7 @@
 
 styles_edit_symbol = '\U0001f58c\uFE0F'  # 🖌️
 styles_materialize_symbol = '\U0001f4cb'  # 📋
+styles_copy_symbol = '\U0001f4dd'  # 📝
 
 
 def select_style(name):
@@ -62,6 +63,7 @@ def __init__(self, tabname, main_ui_prompt, main_ui_negative_prompt):
                 self.selection = gr.Dropdown(label="Styles", elem_id=f"{tabname}_styles_edit_select", choices=list(shared.prompt_styles.styles), value=[], allow_custom_value=True, info="Styles allow you to add custom text to prompt. Use the {prompt} token in style text, and it will be replaced with user's prompt when applying style. Otherwise, style's text will be added to the end of the prompt.")
                 ui_common.create_refresh_button([self.dropdown, self.selection], shared.prompt_styles.reload, lambda: {"choices": list(shared.prompt_styles.styles)}, f"refresh_{tabname}_styles")
                 self.materialize = ui_components.ToolButton(value=styles_materialize_symbol, elem_id=f"{tabname}_style_apply", tooltip="Apply all selected styles from the style selction dropdown in main UI to the prompt.")
+                self.copy = ui_components.ToolButton(value=styles_copy_symbol, elem_id=f"{tabname}_style_copy", tooltip="Copy main UI prompt to style.")
 
             with gr.Row():
                 self.prompt = gr.Textbox(label="Prompt", show_label=True, elem_id=f"{tabname}_edit_style_prompt", lines=3)
@@ -103,6 +105,13 @@ def __init__(self, tabname, main_ui_prompt, main_ui_negative_prompt):
             show_progress=False,
         ).then(fn=None, _js="function(){update_"+tabname+"_tokens(); closePopup();}", show_progress=False)
 
+        self.copy.click(
+            fn=lambda p, n: (p, n),
+            inputs=[main_ui_prompt, main_ui_negative_prompt],
+            outputs=[self.prompt, self.neg_prompt],
+            show_progress=False,
+        )
+
         ui_common.setup_dialog(button_show=edit_button, dialog=styles_dialog, button_close=self.close)
 
 


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

Issue:
[Bug]: Prompt Scheduling Code Comment is Wrong
### Is there an existing issue for this?

- [X] I have searched the existing issues and checked the recent builds/commits

### What happened?

https://github.com/AUTOMATIC1111/stable-diffusion-webui/blob/5ef669de080814067961f28357256e8fe27544f4/modules/prompt_parser.py#L8

```py
# a prompt like this: "fantasy landscape with a [mountain:lake:0.25] and [an oak:a christmas tree:0.75][ in foreground::0.6][ in background:0.25] [shoddy:masterful:0.5]"
# will be represented with prompt_schedule like this (assuming steps=100):
# [25, 'fantasy landscape with a mountain and an oak in foreground shoddy']
# [50, 'fantasy landscape with a lake and an oak in foreground in background shoddy']
# [60, 'fantasy landscape with a lake and an oak in foreground in background masterful']
# [75, 'fantasy landscape with a lake and an oak in background masterful']
# [100, 'fantasy landscape with a lake and a christmas tree in background masterful']
```

Notice that `[ in background:0.25]` has only one colon. This schedule is badly formatted. Currently, this represents an "emphasis" rather than a schedule.

If this example is to match the output above, it needs to be `[:in background:0.25]`

### Steps to reproduce the problem

.

### What should have happened?

.

### Sysinfo

.

### What browsers do you use to access the UI ?

_No response_

### Console logs

```Shell
.
```


### Additional information

_No response_


Discussion:

Resolving patch:
diff --git a/modules/prompt_parser.py b/modules/prompt_parser.py
--- a/modules/prompt_parser.py
+++ b/modules/prompt_parser.py
@@ -5,7 +5,7 @@
 from typing import List
 import lark
 
-# a prompt like this: "fantasy landscape with a [mountain:lake:0.25] and [an oak:a christmas tree:0.75][ in foreground::0.6][ in background:0.25] [shoddy:masterful:0.5]"
+# a prompt like this: "fantasy landscape with a [mountain:lake:0.25] and [an oak:a christmas tree:0.75][ in foreground::0.6][: in background:0.25] [shoddy:masterful:0.5]"
 # will be represented with prompt_schedule like this (assuming steps=100):
 # [25, 'fantasy landscape with a mountain and an oak in foreground shoddy']
 # [50, 'fantasy landscape with a lake and an oak in foreground in background shoddy']


Test patch: