Update optim.py

This commit is contained in:
jinzr 2023-11-03 10:49:02 +08:00
parent 23913f6afd
commit f0285bb4f5

View File

@ -456,6 +456,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
first_state["model_norm_threshold"] = threshold
percent_clipped = (