Skip to content

Commit b412c91

Browse files
authored
[fix] define blocksize
define blocksize as just showing number is a bit confusing
1 parent 55b84ee commit b412c91

1 file changed

Lines changed: 2 additions & 1 deletion

File tree

bitsandbytes/optim/ademamix.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,9 @@ def init_state(self, group, p, gindex, pindex):
166166
self.name2qmap["dynamic"] = state["qmap1"] = self.name2qmap["dynamic"].to(p.device)
167167
self.name2qmap["udynamic"] = state["qmap2"] = self.name2qmap["udynamic"].to(p.device)
168168

169+
blocksize = 256
169170
n = p.numel()
170-
blocks = (n // 256) + bool(n % 256)
171+
blocks = (n // blocksize) + bool(n % blocksize)
171172

172173
state["absmax1"] = torch.zeros((2, blocks), dtype=torch.float32, device=p.device)
173174
state["absmax2"] = torch.zeros((blocks,), dtype=torch.float32, device=p.device)

0 commit comments

Comments
 (0)