(self)
| 233 | torch.save(ckpt, best_ckpt_filepath) |
| 234 | |
| 235 | def restore(self): |
| 236 | self.trainer.writer.write("Restoring checkpoint") |
| 237 | best_path = os.path.join(self.ckpt_foldername, self.ckpt_prefix + "best.ckpt") |
| 238 | |
| 239 | if os.path.exists(best_path): |
| 240 | ckpt = self._torch_load(best_path) |
| 241 | self.trainer.model.load_state_dict(ckpt["model"]) |
| 242 | self.trainer.optimizer.load_state_dict(ckpt["optimizer"]) |
| 243 | |
| 244 | def finalize(self): |
| 245 | torch.save(self.trainer.model.state_dict(), self.pth_filepath) |
no test coverage detected