diff options
author | AUTOMATIC1111 <16777216c@gmail.com> | 2022-12-24 09:22:09 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-12-24 09:22:09 +0000 |
commit | 1b66d527636e3c7f2c177de0ce9b18a31b628f21 (patch) | |
tree | 648961268985dff0767baf15c11e19e4ab7da497 /extensions-builtin/LDSR/scripts | |
parent | eba60a42eb0b7e512de254f44c0e3ed57e7b3ad9 (diff) | |
parent | 8bcdd50461090a2dd238082b33f4c1423378ebbd (diff) | |
download | stable-diffusion-webui-gfx803-1b66d527636e3c7f2c177de0ce9b18a31b628f21.tar.gz stable-diffusion-webui-gfx803-1b66d527636e3c7f2c177de0ce9b18a31b628f21.tar.bz2 stable-diffusion-webui-gfx803-1b66d527636e3c7f2c177de0ce9b18a31b628f21.zip |
Merge pull request #5595 from wywywywy/ldsr-safetensors
Add SafeTensors support to LDSR
Diffstat (limited to 'extensions-builtin/LDSR/scripts')
-rw-r--r-- | extensions-builtin/LDSR/scripts/ldsr_model.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/extensions-builtin/LDSR/scripts/ldsr_model.py b/extensions-builtin/LDSR/scripts/ldsr_model.py index 29d5f94e..b8cff29b 100644 --- a/extensions-builtin/LDSR/scripts/ldsr_model.py +++ b/extensions-builtin/LDSR/scripts/ldsr_model.py @@ -25,6 +25,7 @@ class UpscalerLDSR(Upscaler): 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") + safetensors_model_path = os.path.join(self.model_path, "model.safetensors") if os.path.exists(yaml_path): statinfo = os.stat(yaml_path) if statinfo.st_size >= 10485760: @@ -33,8 +34,11 @@ class UpscalerLDSR(Upscaler): 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.ckpt", progress=True) + if os.path.exists(safetensors_model_path): + model = safetensors_model_path + else: + model = 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) |