Skip to content

Commit

Permalink
Update optim.py (#1366)
Browse files Browse the repository at this point in the history
  • Loading branch information
JinZr authored Nov 3, 2023
1 parent c3bbb32 commit 231bbcd
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions egs/librispeech/ASR/zipformer/optim.py
Original file line number Diff line number Diff line change
Expand Up @@ -466,6 +466,8 @@ def _get_clipping_scale(
quartiles.append(sorted_norms[index].item())

median = quartiles[2]
if median - median != 0:
raise RuntimeError("Too many grads were not finite")
threshold = clipping_scale * median
if step in irregular_estimate_steps:
# use larger thresholds on first few steps of estimating threshold,
Expand Down

0 comments on commit 231bbcd

Please sign in to comment.