mirror of
https://github.com/k2-fsa/icefall.git
synced 2025-09-07 16:14:17 +00:00
Update optim.py
This commit is contained in:
parent
23913f6afd
commit
f0285bb4f5
@ -456,6 +456,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
|
||||||
first_state["model_norm_threshold"] = threshold
|
first_state["model_norm_threshold"] = threshold
|
||||||
percent_clipped = (
|
percent_clipped = (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user