MCPcopy
hub / github.com/zjhuang22/maskscoring_rcnn / save

Method save

maskrcnn_benchmark/utils/checkpoint.py:32–50  ·  view source on GitHub ↗
(self, name, **kwargs)

Source from the content-addressed store, hash-verified

30 self.logger = logger
31
32 def save(self, name, **kwargs):
33 if not self.save_dir:
34 return
35
36 if not self.save_to_disk:
37 return
38
39 data = {}
40 data["model"] = self.model.state_dict()
41 if self.optimizer is not None:
42 data["optimizer"] = self.optimizer.state_dict()
43 if self.scheduler is not None:
44 data["scheduler"] = self.scheduler.state_dict()
45 data.update(kwargs)
46
47 save_file = os.path.join(self.save_dir, "{}.pth".format(name))
48 self.logger.info("Saving checkpoint to {}".format(save_file))
49 torch.save(data, save_file)
50 self.tag_last_checkpoint(save_file)
51
52 def load(self, f=None):
53 if self.has_checkpoint():

Callers 5

scatter_gatherFunction · 0.80
inferenceFunction · 0.80
do_trainFunction · 0.80

Calls 2

tag_last_checkpointMethod · 0.95
updateMethod · 0.45

Tested by 2