Modify cnnctc network save checkpoint.

This commit is contained in:
zhanghuiyao 2021-02-01 16:35:42 +08:00
parent e258315885
commit 177bdd8f4b
1 changed files with 6 additions and 3 deletions

View File

@ -80,10 +80,13 @@ def train(args_opt, config):
keep_checkpoint_max=config.KEEP_CKPT_MAX_NUM)
ckpoint_cb = ModelCheckpoint(prefix="CNNCTC", config=config_ck, directory=config.SAVE_PATH)
if args_opt.run_distribute:
if args_opt.device_id == 0:
model.train(config.TRAIN_EPOCHS, ds, callbacks=[callback, ckpoint_cb], dataset_sink_mode=False)
else:
model.train(config.TRAIN_EPOCHS, ds, callbacks=[callback], dataset_sink_mode=False)
else:
model.train(config.TRAIN_EPOCHS, ds, callbacks=[callback, ckpoint_cb], dataset_sink_mode=False)
if __name__ == '__main__':