!15160 fix performance jitter for googlenet train

From: @caojian05
Reviewed-by: @wuxuejian,@oacjiewen
Signed-off-by: @wuxuejian
This commit is contained in:
mindspore-ci-bot 2021-04-14 20:18:06 +08:00 committed by Gitee
commit 5c60b57c3a
1 changed files with 5 additions and 1 deletions

View File

@ -205,5 +205,9 @@ if __name__ == '__main__':
ckpoint_cb = ModelCheckpoint(prefix="train_googlenet_" + args_opt.dataset_name, directory=ckpt_save_dir,
config=config_ck)
loss_cb = LossMonitor()
model.train(cfg.epoch_size, dataset, callbacks=[time_cb, ckpoint_cb, loss_cb])
cbs = [time_cb, ckpoint_cb, loss_cb]
if device_num > 1 and rank != 0:
cbs = [time_cb, loss_cb]
model.train(cfg.epoch_size, dataset, callbacks=cbs)
print("train success")