aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorleko <rexx0520@gmail.com>2022-10-07 15:09:21 +0000
committerAUTOMATIC1111 <16777216c@gmail.com>2022-10-08 09:38:50 +0000
commit616b7218f7c469d25c138634472017a7e18e742e (patch)
treeee464c77025835e1b4e5ec756fe5ea1053b82da0
parent87db6f01cc6b118fe0c82c36c6686d72d060c417 (diff)
downloadstable-diffusion-webui-gfx803-616b7218f7c469d25c138634472017a7e18e742e.tar.gz
stable-diffusion-webui-gfx803-616b7218f7c469d25c138634472017a7e18e742e.tar.bz2
stable-diffusion-webui-gfx803-616b7218f7c469d25c138634472017a7e18e742e.zip
fix: handles when state_dict does not exist
-rw-r--r--modules/sd_models.py6
1 files changed, 5 insertions, 1 deletions
diff --git a/modules/sd_models.py b/modules/sd_models.py
index 8f794b47..9409d070 100644
--- a/modules/sd_models.py
+++ b/modules/sd_models.py
@@ -122,7 +122,11 @@ def load_model_weights(model, checkpoint_file, sd_model_hash):
pl_sd = torch.load(checkpoint_file, map_location="cpu")
if "global_step" in pl_sd:
print(f"Global Step: {pl_sd['global_step']}")
- sd = pl_sd["state_dict"]
+
+ if "state_dict" in pl_sd:
+ sd = pl_sd["state_dict"]
+ else:
+ sd = pl_sd
model.load_state_dict(sd, strict=False)