1
0
Fork 0

fix(api): unwrap state dict from VAE

This commit is contained in:
Sean Sube 2023-02-17 08:23:12 -06:00
parent c74d22aa42
commit 37b173d0d1
Signed by: ssube
GPG Key ID: 3EED7B957D362AF1
1 changed files with 3 additions and 1 deletions

View File

@ -221,7 +221,9 @@ def load_tensor(name: str, map_location=None):
"failed to load with Torch JIT, falling back to PyTorch", e
)
checkpoint = torch.load(name, map_location=map_location)
checkpoint = (
checkpoint["state_dict"] if "state_dict" in checkpoint else checkpoint
)
else:
logger.debug("loading ckpt")
checkpoint = torch.load(name, map_location=map_location)