Skip to content
Merged
Changes from 1 commit
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
16 changes: 4 additions & 12 deletions python/sglang/srt/layers/quantization/fp8.py
Original file line number Diff line number Diff line change
Expand Up @@ -932,20 +932,12 @@ def process_weights_after_loading_block_quant(self, layer: Module) -> None:
will_use_deepgemm = self.is_deepgemm_moe_runner_backend_enabled()

if self.is_fp4_expert:
if get_moe_runner_backend().is_marlin():
layer.w13_weight.data = layer.w13_weight.data.view(torch.int8)
layer.w2_weight.data = layer.w2_weight.data.view(torch.int8)
elif not get_moe_runner_backend().is_flashinfer_mxfp4():
raise NotImplementedError(
"DeepSeekV4 FP4 experts now require a native FP4 MoE backend. "
"Use `--moe-runner-backend marlin` on Hopper or "
"`--moe-runner-backend flashinfer_mxfp4` when available."
)
layer.w13_weight.data = layer.w13_weight.data.view(torch.int8)
layer.w2_weight.data = layer.w2_weight.data.view(torch.int8)

if get_moe_runner_backend().is_marlin():

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

we don't need the pass branch here. just comment here if you want to notice marlin.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I think we also need to add comments to clarify the three moe backends we supported and which branch they should go.

pass # Hopper w4a16: int8 view is sufficient
else:
layer.w13_weight.data = layer.w13_weight.data.view(torch.int8)
layer.w2_weight.data = layer.w2_weight.data.view(torch.int8)

if envs.SGLANG_OPT_USE_DEEPGEMM_MEGA_MOE.get():
from sglang.srt.models.deepseek_v4 import (
build_mega_moe_experts_weights,
Expand Down
Loading