aboutsummaryrefslogtreecommitdiffstats
path: root/modules/extras.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2022-10-02 14:03:01 +0000
committerGitHub <noreply@github.com>2022-10-02 14:03:01 +0000
commita9d7eb722f9034d1d2203dada6d79651ad3edeec (patch)
treef622f9f86b77a46f673a08084d4a10db59aeff40 /modules/extras.py
parentf28ce3e3a17ccd9b4a03317031a4e3caa1a3088f (diff)
parent4e72a1aab6d1b3a8d8c09fadc81843a07c05cc18 (diff)
downloadstable-diffusion-webui-gfx803-a9d7eb722f9034d1d2203dada6d79651ad3edeec.tar.gz
stable-diffusion-webui-gfx803-a9d7eb722f9034d1d2203dada6d79651ad3edeec.tar.bz2
stable-diffusion-webui-gfx803-a9d7eb722f9034d1d2203dada6d79651ad3edeec.zip
Merge branch 'master' into saving
Diffstat (limited to 'modules/extras.py')
-rw-r--r--modules/extras.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/modules/extras.py b/modules/extras.py
index c2543fcf..6a0d5cb0 100644
--- a/modules/extras.py
+++ b/modules/extras.py
@@ -40,6 +40,8 @@ def run_extras(extras_mode, image, image_folder, gfpgan_visibility, codeformer_v
outputs = []
for image, image_name in zip(imageArr, imageNameArr):
+ if image is None:
+ return outputs, "Please select an input image.", ''
existing_pnginfo = image.info or {}
image = image.convert("RGB")
@@ -74,7 +76,7 @@ def run_extras(extras_mode, image, image_folder, gfpgan_visibility, codeformer_v
c = cached_images.get(key)
if c is None:
upscaler = shared.sd_upscalers[scaler_index]
- c = upscaler.upscale(image, image.width * resize, image.height * resize)
+ c = upscaler.scaler.upscale(image, resize, upscaler.data_path)
cached_images[key] = c
return c
@@ -189,9 +191,11 @@ def run_modelmerger(primary_model_name, secondary_model_name, interp_method, int
if save_as_half:
theta_0[key] = theta_0[key].half()
+ ckpt_dir = shared.cmd_opts.ckpt_dir or sd_models.model_path
+
filename = primary_model_info.model_name + '_' + str(round(interp_amount, 2)) + '-' + secondary_model_info.model_name + '_' + str(round((float(1.0) - interp_amount), 2)) + '-' + interp_method.replace(" ", "_") + '-merged.ckpt'
filename = filename if custom_name == '' else (custom_name + '.ckpt')
- output_modelname = os.path.join(shared.cmd_opts.ckpt_dir, filename)
+ output_modelname = os.path.join(ckpt_dir, filename)
print(f"Saving to {output_modelname}...")
torch.save(primary_model, output_modelname)