MCPcopy Create free account
hub / github.com/bitsandbytes-foundation/bitsandbytes / one_step

Function one_step

tests/test_optim.py:703–709  ·  view source on GitHub ↗
(max_unorm)

Source from the content-addressed store, hash-verified

701 # tight and a loose value produced identical updates. Runs on CPU, which implements
702 # the 32-bit LAMB kernel.
703 def one_step(max_unorm):
704 torch.manual_seed(0)
705 p = torch.nn.Parameter(torch.randn(128, 128))
706 opt = bnb.optim.LAMB([p], lr=1e-1, max_unorm=max_unorm)
707 p.grad = torch.randn(128, 128) * 5.0
708 opt.step()
709 return p.detach().clone()
710
711 tight = one_step(1e-4) # aggressive clipping
712 loose = one_step(10.0) # effectively no clipping

Callers 1

Calls 1

stepMethod · 0.45

Tested by

no test coverage detected