[Fix] Remove assertion for padding for NVFP4 weight scales to fix GLM 4.5 NVFP4 (#12497)

This commit is contained in:
b8zhong
2026-01-14 16:57:14 -08:00
committed by GitHub
parent 424a380077
commit 4346db5faf

View File

@@ -1510,10 +1510,13 @@ class ModelOptNvFp4FusedMoEMethod(FusedMoEMethodBase):
weight_scale.shape[-1] == expected_blocks[name]
), f"Expected {name}_weight_scale.dim(2) == {expected_blocks[name]}, got {weight_scale.shape[-1]}"
else:
# For other backends, ensure the per-input block dimension is aligned to 16.
assert (
weight_scale.shape[assert_dim] % block_size == 0
), f"Expected {name}_weight_scale.dim({assert_dim}) to be divisible by {block_size}"
if weight_scale.shape[assert_dim] % 4 != 0:
logger.warning(
"NVFP4 %s_weight_scale K' not multiple of 4: shape=%s, group_size=%s",
name,
tuple(weight_scale.shape),
getattr(self.quant_config, "group_size", None),
)
assert (
weight_scale.dtype == torch.float8_e4m3fn
), f"{name} Weight Blockscale must be represented as FP8-E4M3"