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