Compare commits

...

7 Commits

Author SHA1 Message Date
w-e-w a1219e84e2 hires button, opt insert gallery
add option to insert the resulting images into Gallery as opposed to replace original when using high button to perform upscale
2024-08-19 06:23:25 +09:00
AUTOMATIC1111 48239090f1 Merge branch 'master' into dev 2024-07-27 15:50:26 +03:00
AUTOMATIC1111 82a973c043 changelog 2024-07-27 15:49:39 +03:00
AUTOMATIC1111 1d7e9eca09 Merge pull request #16275 from AUTOMATIC1111/fix-image-upscale-on-cpu
fix image upscale on cpu
2024-07-27 15:48:22 +03:00
AUTOMATIC1111 850e14923e Merge pull request #16275 from AUTOMATIC1111/fix-image-upscale-on-cpu
fix image upscale on cpu
2024-07-27 15:47:49 +03:00
w-e-w 8e0881d9ab fix image upscale on cpu
for some reason upscale using cpu will fail with
RuntimeError: Inplace update to inference tensor outside InferenceMode
switch from no_grad to inference_mode seems to have fixed it
2024-07-27 21:28:10 +09:00
AUTOMATIC1111 834297b13d Merge branch 'master' into dev 2024-07-27 07:09:08 +03:00
4 changed files with 15 additions and 4 deletions
+6
View File
@@ -1,3 +1,9 @@
## 1.10.1
### Bug Fixes:
* fix image upscale on cpu ([#16275](https://github.com/AUTOMATIC1111/stable-diffusion-webui/pull/16275))
## 1.10.0
### Features:
+1
View File
@@ -314,6 +314,7 @@ options_templates.update(options_section(('ui_gallery', "Gallery", "ui"), {
"sd_webui_modal_lightbox_toolbar_opacity": OptionInfo(0.9, "Full page image viewer: tool bar opacity", gr.Slider, {"minimum": 0.0, "maximum": 1, "step": 0.01}, onchange=shared.reload_gradio_theme).info('for mouse only').needs_reload_ui(),
"gallery_height": OptionInfo("", "Gallery height", gr.Textbox).info("can be any valid CSS value, for example 768px or 20em").needs_reload_ui(),
"open_dir_button_choice": OptionInfo("Subdirectory", "What directory the [📂] button opens", gr.Radio, {"choices": ["Output Root", "Subdirectory", "Subdirectory (even temp dir)"]}),
"hires_button_gallery_inset": OptionInfo(False, "Insert [✨] hires button results to gallery").info("when False the original first pass image is replaced by the results"),
}))
options_templates.update(options_section(('ui_alternatives', "UI alternatives", "ui"), {
+7 -3
View File
@@ -87,15 +87,19 @@ def txt2img_upscale(id_task: str, request: gr.Request, gallery, gallery_index, g
new_gallery = []
for i, image in enumerate(gallery):
if i == gallery_index:
geninfo["infotexts"][gallery_index: gallery_index+1] = processed.infotexts
if shared.opts.hires_button_gallery_inset:
fake_image = Image.new(mode="RGB", size=(1, 1))
fake_image.already_saved_as = image["name"].rsplit('?', 1)[0]
new_gallery.append(fake_image)
geninfo["infotexts"][gallery_index+1: gallery_index+1] = processed.infotexts
else:
geninfo["infotexts"][gallery_index: gallery_index+1] = processed.infotexts
new_gallery.extend(processed.images)
else:
fake_image = Image.new(mode="RGB", size=(1, 1))
fake_image.already_saved_as = image["name"].rsplit('?', 1)[0]
new_gallery.append(fake_image)
geninfo["infotexts"][gallery_index] = processed.info
return new_gallery, json.dumps(geninfo), plaintext_to_html(processed.info), plaintext_to_html(processed.comments, classname="comments")
+1 -1
View File
@@ -41,7 +41,7 @@ def upscale_pil_patch(model, img: Image.Image) -> Image.Image:
"""
param = torch_utils.get_param(model)
with torch.no_grad():
with torch.inference_mode():
tensor = pil_image_to_torch_bgr(img).unsqueeze(0) # add batch dimension
tensor = tensor.to(device=param.device, dtype=param.dtype)
with devices.without_autocast():