diff options
author | ssysm <me@theeditorstudio.com> | 2022-10-10 17:25:28 +0000 |
---|---|---|
committer | ssysm <me@theeditorstudio.com> | 2022-10-10 17:25:28 +0000 |
commit | af62ad4d25dcd0454944368f4925d83101cdedbc (patch) | |
tree | 7ca932843c9b2bbefc9edb9087db15f38d730364 /modules | |
parent | 6fdad291bd5a5edacedec73cf4d0e3852d00300e (diff) | |
download | stable-diffusion-webui-gfx803-af62ad4d25dcd0454944368f4925d83101cdedbc.tar.gz stable-diffusion-webui-gfx803-af62ad4d25dcd0454944368f4925d83101cdedbc.tar.bz2 stable-diffusion-webui-gfx803-af62ad4d25dcd0454944368f4925d83101cdedbc.zip |
change vae loading method
Diffstat (limited to 'modules')
-rw-r--r-- | modules/sd_models.py | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py index b0e1d8bd..7a42d924 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -150,9 +150,16 @@ def load_model_weights(model, checkpoint_info): devices.dtype = torch.float32 if shared.cmd_opts.no_half else torch.float16
- vae_file = shared.cmd_opts.vae_path or os.path.splitext(checkpoint_file)[0] + ".vae.pt"
+ vae_file = os.path.splitext(checkpoint_file)[0] + ".vae.pt"
+ if os.path.exists(vae_file):
+ print(f"Found VAE Weights: {vae_file}")
+ elif shared.cmd_opts.vae_path != None:
+ vae_file = shared.cmd_opts.vae_path
+ print(f'No VAE found for inside the model folder. Using CLI specified : {vae_file}')
+ else:
+ print("No VAE found for inside the model folder. Passing.")
+
if os.path.exists(vae_file):
- print(f"Loading VAE weights from: {vae_file}")
vae_ckpt = torch.load(vae_file, map_location="cpu")
vae_dict = {k: v for k, v in vae_ckpt["state_dict"].items() if k[0:4] != "loss"}
|