MCPcopy
hub / github.com/facebookresearch/mmf / restore

Method restore

pythia/utils/checkpoint.py:235–242  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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)

Callers 2

__call__Method · 0.80
finalizeMethod · 0.80

Calls 3

_torch_loadMethod · 0.95
writeMethod · 0.80
load_state_dictMethod · 0.80

Tested by

no test coverage detected