(self, path, ignore_keys=list())
| 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 | |
| 552 | class VideoAutoencoderInferenceWrapper(VideoAutoencodingEngine): |
no test coverage detected