From b9db1587656679bfadf8c409ceebbb7ac4034a22 Mon Sep 17 00:00:00 2001 From: Mostafa Gamal Date: Tue, 20 Mar 2018 18:44:47 +0200 Subject: [PATCH] A bug in model saving is fixed. --- base_train.py | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/base_train.py b/base_train.py index c5f3b8c..d3ec735 100755 --- a/base_train.py +++ b/base_train.py @@ -10,12 +10,6 @@ def __init__(self, sess, model, args): self.summary_placeholders = {} self.summary_ops = {} - # init the global step, global time step, the current epoch and the summaries - self.__init_global_step() - self.__init_global_time_step() - self.__init_cur_epoch() - self.__init_global_saver() - def save(self): print("Saving model...") self.saver.save(self.sess, self.args.checkpoint_dir, self.global_step_tensor) @@ -35,6 +29,11 @@ def __init_global_saver(self): self.summary_writer = tf.summary.FileWriter(self.args.summary_dir, self.sess.graph) def _init_model(self): + # init the global step, global time step, the current epoch and the summaries + self.__init_global_step() + self.__init_global_time_step() + self.__init_cur_epoch() + self.__init_global_saver() self.init = tf.group(tf.global_variables_initializer(), tf.local_variables_initializer()) self.sess.run(self.init)