Skip to content

Commit 7a2d740

Browse files
committed
Fix HIGGS hook: add clarifying comment about remainder handling
1 parent 560ddf7 commit 7a2d740

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

baselines/opt_sym/eval_ppl.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1405,11 +1405,13 @@ def pre_hook(mod, args_):
14051405
# Find nearest codewords (use _chunked_nearest like working BNF)
14061406
idx = _chunked_nearest(groups, q_cb.to(W.device), chunk_size=100000)
14071407

1408-
# Dequantize
1408+
# Dequantize (returns values on unit sphere)
14091409
dq_groups = d_cb.to(W.device)[idx]
14101410
dq_vq = dq_groups.reshape(normalized.shape[0], elems_per_p)
14111411

14121412
if rem > 0:
1413+
# rem_part is normalized (unit scale), dq_vq is normalized
1414+
# Both need to be multiplied by absmax to denormalize
14131415
rem_part = normalized[:, elems_per_p:]
14141416
dequantized = torch.cat([dq_vq, rem_part], dim=1) * absmax
14151417
else:

0 commit comments

Comments
 (0)