Merge branch 'k2-fsa:master' into dev/multi-zh-streaming-decoding

This commit is contained in:
zr_jin 2023-11-05 16:36:01 +08:00 committed by GitHub
commit 66f5a8b69c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -466,6 +466,8 @@ class ScaledAdam(BatchedOptimizer):
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,