fix test_weight_checker_comparator assertion and ue8m0 scale unpack (#29623)

This commit is contained in:
Yueming Yuan
2026-06-28 23:36:37 -07:00
committed by GitHub
parent f85cc94d82
commit cd91dd0757
2 changed files with 6 additions and 1 deletions
@@ -59,6 +59,8 @@ class Fp8BlockComparable(ComparableWeight):
def _normalize_scale(w_q: torch.Tensor, w_s: torch.Tensor) -> torch.Tensor:
if w_s.dtype == torch.int32:
w_s = inverse_transform_scale_ue8m0(w_s, mn=w_q.shape[-2])
# ue8m0 packing aligns k to a multiple of 4; drop the padding blocks.
w_s = w_s[..., : -(-w_q.shape[-1] // 128)]
return w_s.to(torch.float32)
@staticmethod