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

Method init_from_ckpt

sat/sgm/models/autoencoder.py:539–549  ·  view source on GitHub ↗
(self, path, ignore_keys=list())

Source from the content-addressed store, hash-verified

537 self.init_from_ckpt(ckpt)
538
539 def init_from_ckpt(self, path, ignore_keys=list()):
540 sd = torch.load(path, map_location="cpu")["state_dict"]
541 keys = list(sd.keys())
542 for k in keys:
543 for ik in ignore_keys:
544 if k.startswith(ik):
545 del sd[k]
546 missing_keys, unexpected_keys = self.load_state_dict(sd, strict=False)
547 print("Missing keys: ", missing_keys)
548 print("Unexpected keys: ", unexpected_keys)
549 print(f"Restored from {path}")
550
551
552class 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