Skip to content

Commit

Permalink
.
Browse files Browse the repository at this point in the history
  • Loading branch information
KellerJordan committed Oct 13, 2024
1 parent 9d80717 commit fbe15ed
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion train_gpt2.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def zeropower_via_newtonschulz5(G, steps=10, eps=1e-7):
"""
assert len(G.shape) == 2
a, b, c = (3.4445, -4.7750, 2.0315)
X = G.bfloat16() / (G.norm() + eps) # ensure top singular value <= 1
X = G.bfloat16()
X /= (X.norm() + eps) # ensure top singular value <= 1
if G.size(0) > G.size(1):
X = X.T
for _ in range(steps):
Expand Down

0 comments on commit fbe15ed

Please sign in to comment.