From 3f43784964dda7ff5f3375d5db9bfa88f3fd26b9 Mon Sep 17 00:00:00 2001 From: kangguangli Date: Fri, 10 Feb 2023 08:47:16 +0000 Subject: [PATCH] remove with_data_parallel in program.compile --- ppcls/static/program.py | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/ppcls/static/program.py b/ppcls/static/program.py index 5c28af0a..188393d1 100644 --- a/ppcls/static/program.py +++ b/ppcls/static/program.py @@ -153,12 +153,6 @@ def create_strategy(config): exec_strategy: exec strategy """ build_strategy = paddle.static.BuildStrategy() - exec_strategy = paddle.static.ExecutionStrategy() - - exec_strategy.num_threads = 1 - exec_strategy.num_iteration_per_drop_scope = ( - 10000 - if 'AMP' in config and config.AMP.get("level", "O1") == "O2" else 10) fuse_op = True if 'AMP' in config else False @@ -172,7 +166,7 @@ def create_strategy(config): build_strategy.fuse_bn_add_act_ops = fuse_bn_add_act_ops build_strategy.enable_addto = enable_addto - return build_strategy, exec_strategy + return build_strategy def dist_optimizer(config, optimizer): @@ -186,10 +180,9 @@ def dist_optimizer(config, optimizer): Returns: optimizer: a distributed optimizer """ - build_strategy, exec_strategy = create_strategy(config) + build_strategy = create_strategy(config) dist_strategy = DistributedStrategy() - dist_strategy.execution_strategy = exec_strategy dist_strategy.build_strategy = build_strategy dist_strategy.nccl_comm_num = 1 @@ -298,14 +291,10 @@ def compile(config, program, loss_name=None, share_prog=None): Returns: compiled_program(): a compiled program """ - build_strategy, exec_strategy = create_strategy(config) + build_strategy = create_strategy(config) compiled_program = paddle.static.CompiledProgram( - program).with_data_parallel( - share_vars_from=share_prog, - loss_name=loss_name, - build_strategy=build_strategy, - exec_strategy=exec_strategy) + program, build_strategy=build_strategy) return compiled_program -- GitLab