Skip to content

Commit

Permalink
skip data_stat in init_from_model and restart mode
Browse files Browse the repository at this point in the history
`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.
  • Loading branch information
njzjz committed Jan 28, 2022
1 parent 1ee6987 commit 1435326
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion deepmd/train/trainer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down

0 comments on commit 1435326

Please sign in to comment.