mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-08-08 09:32:20 +00:00
Update optim.py (#1366)
This commit is contained in:
parent
c3bbb32f9e
commit
231bbcd2b6
@ -466,6 +466,8 @@ class ScaledAdam(BatchedOptimizer):
|
|||||||
quartiles.append(sorted_norms[index].item())
|
quartiles.append(sorted_norms[index].item())
|
||||||
|
|
||||||
median = quartiles[2]
|
median = quartiles[2]
|
||||||
|
if median - median != 0:
|
||||||
|
raise RuntimeError("Too many grads were not finite")
|
||||||
threshold = clipping_scale * median
|
threshold = clipping_scale * median
|
||||||
if step in irregular_estimate_steps:
|
if step in irregular_estimate_steps:
|
||||||
# use larger thresholds on first few steps of estimating threshold,
|
# use larger thresholds on first few steps of estimating threshold,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user