From 9dedafa0df88042b348c502da07e55841df4a7a9 Mon Sep 17 00:00:00 2001 From: mapingshuo Date: Wed, 16 Sep 2020 06:53:17 +0800 Subject: [PATCH] fix strategy, test=develop (#27323) * fix strategy, test=develop * fix can_apply --- python/paddle/distributed/fleet/base/strategy_compiler.py | 2 +- .../distributed/fleet/meta_optimizers/recompute_optimizer.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/python/paddle/distributed/fleet/base/strategy_compiler.py b/python/paddle/distributed/fleet/base/strategy_compiler.py index 4097fc1237f..29e10661888 100644 --- a/python/paddle/distributed/fleet/base/strategy_compiler.py +++ b/python/paddle/distributed/fleet/base/strategy_compiler.py @@ -60,7 +60,7 @@ class StrategyCompiler(StrategyCompilerBase): def _get_valid_strategy(self, dist_strategy, can_not_apply_optimizer_list): import copy - valid_strategy = copy.copy(dist_strategy) + valid_strategy = copy.deepcopy(dist_strategy) invalid_optimizers = [] for candidate in self._meta_optimizer_candidates: is_valid = False diff --git a/python/paddle/distributed/fleet/meta_optimizers/recompute_optimizer.py b/python/paddle/distributed/fleet/meta_optimizers/recompute_optimizer.py index 8f959548692..59ca7e63309 100644 --- a/python/paddle/distributed/fleet/meta_optimizers/recompute_optimizer.py +++ b/python/paddle/distributed/fleet/meta_optimizers/recompute_optimizer.py @@ -38,7 +38,7 @@ class RecomputeOptimizer(MetaOptimizerBase): list(user_defined_strategy.recompute_configs["checkpoints"])) def _can_apply(self): - if self.role_maker._is_collective: + if not self.role_maker._is_collective: return False if self.user_defined_strategy.recompute == True: -- GitLab