diff --git a/example/resnet101_imagenet2012/config.py b/example/resnet101_imagenet2012/config.py index 5f07014ad35b424038e63e4347e6a18a7cf44a2e..594b28522ac1c07f45f646773efd621e84a4d27b 100755 --- a/example/resnet101_imagenet2012/config.py +++ b/example/resnet101_imagenet2012/config.py @@ -29,7 +29,7 @@ config = ed({ "image_height": 224, "image_width": 224, "save_checkpoint": True, - "save_checkpoint_epochs": 1, + "save_checkpoint_epochs": 5, "keep_checkpoint_max": 10, "save_checkpoint_path": "./", "warmup_epochs": 0, diff --git a/example/resnet50_cifar10/config.py b/example/resnet50_cifar10/config.py index c148e4329c7778ca41bd84c212d3f6b0872a0b90..3c50a6aaed1b6d1f6bbb4403a11a474a00e2b1e3 100755 --- a/example/resnet50_cifar10/config.py +++ b/example/resnet50_cifar10/config.py @@ -28,7 +28,7 @@ config = ed({ "image_height": 224, "image_width": 224, "save_checkpoint": True, - "save_checkpoint_steps": 1950, + "save_checkpoint_epochs": 5, "keep_checkpoint_max": 10, "save_checkpoint_path": "./", "warmup_epochs": 5, diff --git a/example/resnet50_cifar10/train.py b/example/resnet50_cifar10/train.py index 93efed7338153f5101f5e0bcf4493d92c427a7c4..275f7188a7c396a5b9aa850e018f2f579a817730 100755 --- a/example/resnet50_cifar10/train.py +++ b/example/resnet50_cifar10/train.py @@ -43,6 +43,8 @@ args_opt = parser.parse_args() if __name__ == '__main__': target = args_opt.device_target + ckpt_save_dir = config.save_checkpoint_path + context.set_context(mode=context.GRAPH_MODE, device_target=target, save_graphs=False) if not args_opt.do_eval and args_opt.run_distribute: if target == "Ascend": device_id = int(os.getenv('DEVICE_ID')) @@ -80,13 +82,13 @@ if __name__ == '__main__': else: loss = SoftmaxCrossEntropyWithLogits(sparse=True, reduction='mean') model = Model(net, loss_fn=loss, optimizer=opt, loss_scale_manager=loss_scale, metrics={'acc'}, - amp_level="O2", keep_batchnorm_fp32=True) + amp_level="O2", keep_batchnorm_fp32=False) time_cb = TimeMonitor(data_size=step_size) loss_cb = LossMonitor() cb = [time_cb, loss_cb] if config.save_checkpoint: - config_ck = CheckpointConfig(save_checkpoint_steps=config.save_checkpoint_steps, + config_ck = CheckpointConfig(save_checkpoint_steps=config.save_checkpoint_epochs*step_size, keep_checkpoint_max=config.keep_checkpoint_max) ckpt_cb = ModelCheckpoint(prefix="resnet", directory=ckpt_save_dir, config=config_ck) cb += [ckpt_cb] diff --git a/example/resnet50_imagenet2012/config.py b/example/resnet50_imagenet2012/config.py index e33c2b6aa09f28d5d19956cbb5b89f7173d3e8bd..cf5093d245b9310ea6c694210a8953517c342e18 100755 --- a/example/resnet50_imagenet2012/config.py +++ b/example/resnet50_imagenet2012/config.py @@ -29,7 +29,7 @@ config = ed({ "image_height": 224, "image_width": 224, "save_checkpoint": True, - "save_checkpoint_epochs": 1, + "save_checkpoint_epochs": 5, "keep_checkpoint_max": 10, "save_checkpoint_path": "./", "warmup_epochs": 0, diff --git a/example/resnet50_imagenet2012/train.py b/example/resnet50_imagenet2012/train.py index 63014804290f61ebeac318e83aa4027d1fe7c52f..a76de78f6d5780fb133cad9e6e2bd61db3e3a878 100755 --- a/example/resnet50_imagenet2012/train.py +++ b/example/resnet50_imagenet2012/train.py @@ -46,6 +46,8 @@ args_opt = parser.parse_args() if __name__ == '__main__': target = args_opt.device_target + ckpt_save_dir = config.save_checkpoint_path + context.set_context(mode=context.GRAPH_MODE, device_target=target, save_graphs=False) if not args_opt.do_eval and args_opt.run_distribute: if target == "Ascend": device_id = int(os.getenv('DEVICE_ID'))