MCPcopy Create free account
hub / github.com/OpenDriveLab/ReSim / init_from_ckpt

Method init_from_ckpt

sat/vae_modules/autoencoder.py:564–575  ·  view source on GitHub ↗
(self, path, ignore_keys=list())

Source from the content-addressed store, hash-verified

562 self.init_from_ckpt(ckpt)
563
564 def init_from_ckpt(self, path, ignore_keys=list()):
565 sd = torch.load(path, map_location="cpu")["state_dict"]
566 keys = list(sd.keys())
567 for k in keys:
568 for ik in ignore_keys:
569 if k.startswith(ik):
570 print("Deleting key {} from state_dict.".format(k))
571 del sd[k]
572 missing_keys, unexpected_keys = self.load_state_dict(sd, strict=False)
573 print("Missing keys: ", missing_keys)
574 print("Unexpected keys: ", unexpected_keys)
575 print(f"Restored from {path}")
576
577
578class VideoAutoencoderInferenceWrapper(VideoAutoencodingEngine):

Callers 2

__init__Method · 0.95
apply_ckptMethod · 0.95

Calls 3

printFunction · 0.50
loadMethod · 0.45
load_state_dictMethod · 0.45

Tested by

no test coverage detected