mirror of
https://github.com/comfyanonymous/ComfyUI.git
synced 2025-01-25 15:55:18 +00:00
Support loading some checkpoint files with nested dicts.
This commit is contained in:
parent
44db978531
commit
7a7efe8424
@ -46,7 +46,13 @@ def load_torch_file(ckpt, safe_load=False, device=None):
|
|||||||
if "state_dict" in pl_sd:
|
if "state_dict" in pl_sd:
|
||||||
sd = pl_sd["state_dict"]
|
sd = pl_sd["state_dict"]
|
||||||
else:
|
else:
|
||||||
sd = pl_sd
|
if len(pl_sd) == 1:
|
||||||
|
key = list(pl_sd.keys())[0]
|
||||||
|
sd = pl_sd[key]
|
||||||
|
if not isinstance(sd, dict):
|
||||||
|
sd = pl_sd
|
||||||
|
else:
|
||||||
|
sd = pl_sd
|
||||||
return sd
|
return sd
|
||||||
|
|
||||||
def save_torch_file(sd, ckpt, metadata=None):
|
def save_torch_file(sd, ckpt, metadata=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user