Ejemplo n.º 1
0
 def get_checkpoint_model(self, version):
     """Read checkpoint using model version"""
     file = self.get_checkpoint_path(version)
     try:
         return load_from_checkpoint_file(file)
     except Exception:
         raise RuntimeError("Failed to read model checkpoint from file " +
                            file)
Ejemplo n.º 2
0
 def _init_model(self, checkpoint_filename_for_init, init_var):
     if checkpoint_filename_for_init:
         pb_model = load_from_checkpoint_file(checkpoint_filename_for_init)
         self._version = pb_model.version
         self._init_model_from_tensor_dict(pb_model.param)
     elif init_var:
         self._init_model_from_var_list(init_var)
     else:
         logger.info("Model is not intialized. It will be "
                     "initialized by the first update from "
                     "the worker.")