From 14353266cd82550c1117e4dfe14a50f1f35d5cc8 Mon Sep 17 00:00:00 2001 From: Jinzhe Zeng Date: Fri, 28 Jan 2022 16:43:01 -0500 Subject: [PATCH] skip `data_stat` in `init_from_model` and `restart` mode `std` and `avg` are stored as variables. `saver.restore` will restore and override it. So `data_stat` before `saver.restore` is useless. Note that currently `init_from_frz_model` does not restore these variables. I also add a message before `data_stat`. It sometimes takes long time. --- deepmd/train/trainer.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/deepmd/train/trainer.py b/deepmd/train/trainer.py index 927074c1c6..21f078b763 100644 --- a/deepmd/train/trainer.py +++ b/deepmd/train/trainer.py @@ -282,7 +282,12 @@ def build (self, )) self.type_map = data.get_type_map() self.batch_size = data.get_batch_size() - self.model.data_stat(data) + if self.run_opt.init_mode not in ('init_from_model', 'restart'): + # self.saver.restore (in self._init_session) will restore avg and std variables, so data_stat is useless + # currently init_from_frz_model does not restore data_stat variables + # TODO: restore avg and std in the init_from_frz_model mode + log.info("data stating... (this step may take long time)") + self.model.data_stat(data) # config the init_frz_model command if self.run_opt.init_mode == 'init_from_frz_model':