Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
djbielejeski committed Apr 6, 2023
1 parent dabb2c4 commit 3699b40
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,6 @@ venv
*.ckpt
/joepenna-dreambooth-configs/
/src/

dreambooth_joepenna
src/taming-transformers
7 changes: 6 additions & 1 deletion ldm/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,12 @@ def load_model_from_config(config, ckpt, verbose=False):
print(f"Loading model from {ckpt}")

pl_sd = torch.load(ckpt, map_location="cpu")
sd = pl_sd["state_dict"]
if "state_dict" in pl_sd:
sd = pl_sd["state_dict"]
else:
print(f"Warning: 'state_dict' key not found in the checkpoint file {ckpt}. Attempting to load the entire checkpoint as the model state.")
sd = pl_sd

config["model"]["params"]["ckpt_path"] = ckpt

print("")
Expand Down

0 comments on commit 3699b40

Please sign in to comment.