Skip to content

Commit

Permalink
fix amp bug of fleet (#31532)
Browse files Browse the repository at this point in the history
  • Loading branch information
ForFishes authored Mar 15, 2021
1 parent 027b574 commit c3634c6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions python/paddle/distributed/fleet/base/fleet_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -637,6 +637,11 @@ def distributed_optimizer(self, optimizer, strategy=None):
self._user_defined_strategy = copy.deepcopy(strategy)

self._context = {}

# TODO(shenliang03): This is a temporary solution to support amp. In the case of a dynamic graph,
# the optimizer is returned directly. This problem will be fixed in the future.
if paddle.fluid.framework.in_dygraph_mode():
return optimizer
return self

@dygraph_only
Expand Down

0 comments on commit c3634c6

Please sign in to comment.