mirror of
https://github.com/AUTOMATIC1111/stable-diffusion-webui.git
synced 2024-06-07 21:20:49 +00:00
change vae loading method
This commit is contained in:
parent
6fdad291bd
commit
af62ad4d25
@ -150,9 +150,16 @@ def load_model_weights(model, checkpoint_info):
|
|||||||
|
|
||||||
devices.dtype = torch.float32 if shared.cmd_opts.no_half else torch.float16
|
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):
|
if os.path.exists(vae_file):
|
||||||
print(f"Loading VAE weights from: {vae_file}")
|
|
||||||
vae_ckpt = torch.load(vae_file, map_location="cpu")
|
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"}
|
vae_dict = {k: v for k, v in vae_ckpt["state_dict"].items() if k[0:4] != "loss"}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user