(ckpt_path, model, device="cpu")
| 59 | |
| 60 | |
| 61 | def load_checkpoint_for_inference(ckpt_path, model, device="cpu"): |
| 62 | checkpoint = torch.load(ckpt_path, map_location=device) |
| 63 | raw_model = model.module if hasattr(model, "module") else model |
| 64 | raw_model.load_state_dict(checkpoint["model_state_dict"], strict=False) |
| 65 | |
| 66 | |
| 67 | @torch.no_grad() |