diff options
author | JC-Array <44535867+JC-Array@users.noreply.github.com> | 2022-10-10 23:06:07 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-10 23:06:07 +0000 |
commit | aca1553bde726e1455f3a73a6378b31e93d3e8f2 (patch) | |
tree | b5492fb630f58deddd9fbf812fdd7d9134a59cc1 /modules/sd_models.py | |
parent | 45fbd1c5fec887988ab555aac75a999d4f3aff40 (diff) | |
parent | 42bf5fa3256bff5e4640e5a626e750d4e49e01e1 (diff) | |
download | stable-diffusion-webui-gfx803-aca1553bde726e1455f3a73a6378b31e93d3e8f2.tar.gz stable-diffusion-webui-gfx803-aca1553bde726e1455f3a73a6378b31e93d3e8f2.tar.bz2 stable-diffusion-webui-gfx803-aca1553bde726e1455f3a73a6378b31e93d3e8f2.zip |
Merge pull request #1 from AUTOMATIC1111/master
updating files to resolve merge conflicts
Diffstat (limited to 'modules/sd_models.py')
-rw-r--r-- | modules/sd_models.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py index e63d3c29..0a55b4c3 100644 --- a/modules/sd_models.py +++ b/modules/sd_models.py @@ -149,8 +149,13 @@ def load_model_weights(model, checkpoint_info): model.half()
devices.dtype = torch.float32 if shared.cmd_opts.no_half else torch.float16
+ devices.dtype_vae = torch.float32 if shared.cmd_opts.no_half or shared.cmd_opts.no_half_vae else torch.float16
vae_file = os.path.splitext(checkpoint_file)[0] + ".vae.pt"
+
+ if not os.path.exists(vae_file) and shared.cmd_opts.vae_path is not None:
+ vae_file = shared.cmd_opts.vae_path
+
if os.path.exists(vae_file):
print(f"Loading VAE weights from: {vae_file}")
vae_ckpt = torch.load(vae_file, map_location="cpu")
@@ -158,6 +163,8 @@ def load_model_weights(model, checkpoint_info): model.first_stage_model.load_state_dict(vae_dict)
+ model.first_stage_model.to(devices.dtype_vae)
+
model.sd_model_hash = sd_model_hash
model.sd_model_checkpoint = checkpoint_file
model.sd_checkpoint_info = checkpoint_info
|