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

Function sanity_check

bitsandbytes/diagnostics/main.py:27–39  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

25
26
27def sanity_check():
28 from bitsandbytes.optim import Adam
29
30 p = torch.nn.Parameter(torch.rand(10, 10).cuda())
31 a = torch.rand(10, 10).cuda()
32 p1 = p.data.sum().item()
33 adam = Adam([p])
34 out = a * p
35 loss = out.sum()
36 loss.backward()
37 adam.step()
38 p2 = p.data.sum().item()
39 assert p1 != p2
40
41
42def get_package_version(name: str) -> str:

Callers 1

mainFunction · 0.85

Calls 4

AdamClass · 0.90
cudaMethod · 0.45
backwardMethod · 0.45
stepMethod · 0.45

Tested by

no test coverage detected