示例#1
0
文件: hooks.py 项目: zerkh/OpenNMT-tf
 def begin(self):
   self._predictions = misc.get_dict_from_collection("predictions")
   if not self._predictions:
     raise RuntimeError("The model did not define any predictions.")
   self._global_step = tf.train.get_global_step()
   if self._global_step is None:
     raise RuntimeError("Global step should be created to use SaveEvaluationPredictionHook.")
示例#2
0
文件: hooks.py 项目: yhgon/OpenNMT-tf
 def begin(self):
   self._predictions = misc.get_dict_from_collection("predictions")
   if not self._predictions:
     raise RuntimeError("The model did not define any predictions.")
   self._global_step = tf.train.get_global_step()
   if self._global_step is None:
     raise RuntimeError("Global step should be created to use SaveEvaluationPredictionHook.")
示例#3
0
 def begin(self):
     self._predictions = misc.get_dict_from_collection("predictions")
     self._saver = tf.train.Saver()
     if not self._predictions:
         raise RuntimeError("The model did not define any predictions.")
     self._global_step = tf.train.get_global_step()
     if self._global_step is None:
         raise RuntimeError(
             "Global step should be created to use SaveEvaluationPredictionHook."
         )
     if self._best_models_dir is not None:
         if not os.path.exists(self._best_models_dir):
             os.makedirs(self._best_models_dir)