aboutsummaryrefslogtreecommitdiffstats
path: root/modules/ldsr_model.py
diff options
context:
space:
mode:
authorAUTOMATIC1111 <16777216c@gmail.com>2022-10-06 17:30:29 +0000
committerGitHub <noreply@github.com>2022-10-06 17:30:29 +0000
commitab4ddbf333eef170804ef8de67001f77c8fdd64c (patch)
tree21cb1109f8eae463aa4066eec0926cd71ab81740 /modules/ldsr_model.py
parent2a7f48cdb8dcf9acb02610cccae0d1ee5d260bc2 (diff)
parentcf7c784fcc0c84a8a4edd8d3aca4dda4c7025c43 (diff)
downloadstable-diffusion-webui-gfx803-ab4ddbf333eef170804ef8de67001f77c8fdd64c.tar.gz
stable-diffusion-webui-gfx803-ab4ddbf333eef170804ef8de67001f77c8fdd64c.tar.bz2
stable-diffusion-webui-gfx803-ab4ddbf333eef170804ef8de67001f77c8fdd64c.zip
Merge branch 'master' into gallery-styling
Diffstat (limited to 'modules/ldsr_model.py')
-rw-r--r--modules/ldsr_model.py17
1 files changed, 14 insertions, 3 deletions
diff --git a/modules/ldsr_model.py b/modules/ldsr_model.py
index 969d1a0d..1c1070fc 100644
--- a/modules/ldsr_model.py
+++ b/modules/ldsr_model.py
@@ -22,9 +22,21 @@ class UpscalerLDSR(Upscaler):
self.scalers = [scaler_data]
def load_model(self, path: str):
+ # Remove incorrect project.yaml file if too big
+ yaml_path = os.path.join(self.model_path, "project.yaml")
+ old_model_path = os.path.join(self.model_path, "model.pth")
+ new_model_path = os.path.join(self.model_path, "model.ckpt")
+ if os.path.exists(yaml_path):
+ statinfo = os.stat(yaml_path)
+ if statinfo.st_size >= 10485760:
+ print("Removing invalid LDSR YAML file.")
+ os.remove(yaml_path)
+ if os.path.exists(old_model_path):
+ print("Renaming model from model.pth to model.ckpt")
+ os.rename(old_model_path, new_model_path)
model = load_file_from_url(url=self.model_url, model_dir=self.model_path,
- file_name="model.pth", progress=True)
- yaml = load_file_from_url(url=self.model_url, model_dir=self.model_path,
+ file_name="model.ckpt", progress=True)
+ yaml = load_file_from_url(url=self.yaml_url, model_dir=self.model_path,
file_name="project.yaml", progress=True)
try:
@@ -41,5 +53,4 @@ class UpscalerLDSR(Upscaler):
print("NO LDSR!")
return img
ddim_steps = shared.opts.ldsr_steps
- pre_scale = shared.opts.ldsr_pre_down
return ldsr.super_resolution(img, ddim_steps, self.scale)