diff --git a/embeddings/Place Textual Inversion embeddings here.txt b/embeddings/Place Textual Inversion embeddings here.txt new file mode 100644 index 000000000..e69de29bb diff --git a/modules/bsrgan_model.py b/modules/bsrgan_model.py index 339f402bc..47346f318 100644 --- a/modules/bsrgan_model.py +++ b/modules/bsrgan_model.py @@ -67,7 +67,7 @@ class UpscalerBSRGAN(modules.upscaler.Upscaler): else: filename = path if not os.path.exists(filename) or filename is None: - print("Unable to load %s from %s" % (self.model_path, filename)) + print(f"BSRGAN: Unable to load model from {filename}", file=sys.stderr) return None model = RRDBNet(in_nc=3, out_nc=3, nf=64, nb=23, gc=32, sf=2) # define network model.load_state_dict(torch.load(filename), strict=True) diff --git a/modules/images.py b/modules/images.py index 169e19e64..f1aed5d6b 100644 --- a/modules/images.py +++ b/modules/images.py @@ -213,17 +213,19 @@ def resize_image(resize_mode, im, width, height): if opts.upscaler_for_img2img is None or opts.upscaler_for_img2img == "None" or im.mode == 'L': return im.resize((w, h), resample=LANCZOS) - upscalers = [x for x in shared.sd_upscalers if x.name == opts.upscaler_for_img2img] - assert len(upscalers) > 0, f"could not find upscaler named {opts.upscaler_for_img2img}" - - upscaler = upscalers[0] scale = max(w / im.width, h / im.height) - upscaled = upscaler.scaler.upscale(im, scale, upscaler.data_path) - if upscaled.width != w or upscaled.height != h: - upscaled = im.resize((w, h), resample=LANCZOS) + if scale > 1.0: + upscalers = [x for x in shared.sd_upscalers if x.name == opts.upscaler_for_img2img] + assert len(upscalers) > 0, f"could not find upscaler named {opts.upscaler_for_img2img}" - return upscaled + upscaler = upscalers[0] + im = upscaler.scaler.upscale(im, scale, upscaler.data_path) + + if im.width != w or im.height != h: + im = im.resize((w, h), resample=LANCZOS) + + return im if resize_mode == 0: res = resize(im, width, height) diff --git a/modules/sd_hijack.py b/modules/sd_hijack.py index 5945b7c23..fa7eaeb89 100644 --- a/modules/sd_hijack.py +++ b/modules/sd_hijack.py @@ -232,7 +232,12 @@ class StableDiffusionModelHijack: for fn in os.listdir(dirname): try: - process_file(os.path.join(dirname, fn), fn) + fullfn = os.path.join(dirname, fn) + + if os.stat(fullfn).st_size == 0: + continue + + process_file(fullfn, fn) except Exception: print(f"Error loading emedding {fn}:", file=sys.stderr) print(traceback.format_exc(), file=sys.stderr) diff --git a/modules/ui.py b/modules/ui.py index ada9a38e9..249b3eea1 100644 --- a/modules/ui.py +++ b/modules/ui.py @@ -599,7 +599,7 @@ def create_ui(txt2img, img2img, run_extras, run_pnginfo, run_modelmerger): mask_mode = gr.Radio(label="Mask mode", show_label=False, choices=["Draw mask", "Upload mask"], type="index", value="Draw mask", elem_id="mask_mode") inpainting_mask_invert = gr.Radio(label='Masking mode', show_label=False, choices=['Inpaint masked', 'Inpaint not masked'], value='Inpaint masked', type="index") - inpainting_fill = gr.Radio(label='Masked content', choices=['fill', 'original', 'latent noise', 'latent nothing'], value='fill', type="index") + inpainting_fill = gr.Radio(label='Masked content', choices=['fill', 'original', 'latent noise', 'latent nothing'], value='original', type="index") with gr.Row(): inpaint_full_res = gr.Checkbox(label='Inpaint at full resolution', value=False)