Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions python/sglang/srt/layers/quantization/modelopt_quant.py
Original file line number Diff line number Diff line change
Expand Up @@ -1438,9 +1438,13 @@ def _slice_scale(w):
("w13", layer.w13_weight_scale),
("w2", layer.w2_weight_scale),
]:
assert (
weight_scale.shape[2] % 16 == 0
), f"Expected {name}_weight_scale.dim(2) to be divisible by 16"
if weight_scale.shape[2] % 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),
)
Comment on lines +1442 to +1447
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The warning message is a bit cryptic with K'. It would be more helpful for developers if the message explicitly stated which dimension is being referred to and what the consequence is (i.e., that padding will be applied).

                logger.warning(
                    "NVFP4 %s_weight_scale last dim not a multiple of 4 (shape=%s, "
                    "group_size=%s). Padding will be applied.",
                    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"
Expand Down
Loading