Skip to content

Commit

Permalink
[hybrid npu] fix npu found_finite in hybrid (PaddlePaddle#35134) (Pad…
Browse files Browse the repository at this point in the history
…dlePaddle#35291)

Co-authored-by: WangXi <wangxi16@baidu.com>
  • Loading branch information
sljlp and wangxicoding committed Aug 31, 2021
1 parent 6fb58ae commit e64105f
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -369,8 +369,11 @@ def _adapt_amp_clip_without_sharding(self):
# FIXME(wangxi): mp should prune duplicated param_grads when calc
# amp inf_var & clip global_norm_var

FP16Utils.sync_amp_check_nan_inf(main_block,
[self.mp_ring_id, self.pp_ring_id])
rings = [self.mp_ring_id, self.pp_ring_id]
# FIXME(wangxi): some problem with NPU found_finite, need sync with DP
if core.is_compiled_with_npu():
rings += [self.dp_ring_id]
FP16Utils.sync_amp_check_nan_inf(main_block, rings)

gradientclip_helper = GradientClipHelper(None)
gradientclip_helper.sync_global_norm(
Expand Down

0 comments on commit e64105f

Please sign in to comment.