Skip to content

Commit f1babbd

Browse files
authored
Fix auto parallel api bug (#63405)
* update * remove useless code * fix auto parallel api bug
1 parent 635b240 commit f1babbd

File tree

1 file changed

+15
-10
lines changed
  • python/paddle/distributed/auto_parallel

1 file changed

+15
-10
lines changed

python/paddle/distributed/auto_parallel/api.py

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1929,16 +1929,21 @@ def __convert_strategy(self, strategy):
19291929
inner_strategy.gradient_merge = copy.deepcopy(strategy.gradient_merge)
19301930
inner_strategy.pipeline = copy.deepcopy(strategy.pipeline)
19311931
# The below are template interfaces
1932-
inner_strategy.recompute = copy.deepcopy(strategy._recompute)
1933-
inner_strategy.mp_optimization = copy.deepcopy(
1934-
strategy._mp_optimization
1935-
)
1936-
inner_strategy.dp_optimization = copy.deepcopy(
1937-
strategy._dp_optimization
1938-
)
1939-
inner_strategy.sp_optimization = copy.deepcopy(
1940-
strategy._sp_optimization
1941-
)
1932+
if hasattr(strategy, "_recompute"):
1933+
inner_strategy.recompute = copy.deepcopy(strategy._recompute)
1934+
1935+
if hasattr(strategy, "_mp_optimization"):
1936+
inner_strategy.mp_optimization = copy.deepcopy(
1937+
strategy._mp_optimization
1938+
)
1939+
if hasattr(strategy, "_dp_optimization"):
1940+
inner_strategy.dp_optimization = copy.deepcopy(
1941+
strategy._dp_optimization
1942+
)
1943+
if hasattr(strategy, "_sp_optimization"):
1944+
inner_strategy.sp_optimization = copy.deepcopy(
1945+
strategy._sp_optimization
1946+
)
19421947

19431948
return inner_strategy
19441949

0 commit comments

Comments
 (0)