diff --git a/ppcls/configs/ImageNet/ResNet/ResNet50_fp16.yaml b/ppcls/configs/ImageNet/ResNet/ResNet50_fp16.yaml index f039a60b6d0ff9e1d0cc2f33e662c5856481bfbf..769ff361e497c41846759cc81bc31df5e692bd82 100644 --- a/ppcls/configs/ImageNet/ResNet/ResNet50_fp16.yaml +++ b/ppcls/configs/ImageNet/ResNet/ResNet50_fp16.yaml @@ -16,6 +16,7 @@ Global: save_inference_dir: ./inference # training model under @to_static to_static: False + use_dali: True # mixed precision training AMP: diff --git a/ppcls/static/train.py b/ppcls/static/train.py index e262f27ffdcc827414df459822f45963f3bb0f92..ae2b440526610aff9a56e92688c4c17b9227b545 100644 --- a/ppcls/static/train.py +++ b/ppcls/static/train.py @@ -81,14 +81,13 @@ def main(args): # amp related config if 'AMP' in config: AMP_RELATED_FLAGS_SETTING = { - 'FLAGS_cudnn_exhaustive_search': "1", - 'FLAGS_conv_workspace_size_limit': "1500", - 'FLAGS_cudnn_batchnorm_spatial_persistent': "1", - 'FLAGS_max_indevice_grad_add': "8", - "FLAGS_cudnn_batchnorm_spatial_persistent": "1", + 'FLAGS_cudnn_exhaustive_search': 1, + 'FLAGS_conv_workspace_size_limit': 1500, + 'FLAGS_cudnn_batchnorm_spatial_persistent': 1, + 'FLAGS_max_inplace_grad_add': 8, } - for k in AMP_RELATED_FLAGS_SETTING: - os.environ[k] = AMP_RELATED_FLAGS_SETTING[k] + os.environ['FLAGS_cudnn_batchnorm_spatial_persistent'] = '1' + paddle.fluid.set_flags(AMP_RELATED_FLAGS_SETTING) use_xpu = global_config.get("use_xpu", False) use_npu = global_config.get("use_npu", False)