Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
change
sglang
Commits
288ae41f
Unverified
Commit
288ae41f
authored
Aug 06, 2025
by
Shu Wang
Committed by
GitHub
Aug 06, 2025
Browse files
[NVIDIA] Fix num_experts in modelopt_quant (#8811)
parent
01c99a99
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
python/sglang/srt/layers/moe/fused_moe_triton/layer.py
python/sglang/srt/layers/moe/fused_moe_triton/layer.py
+5
-0
python/sglang/srt/layers/quantization/modelopt_quant.py
python/sglang/srt/layers/quantization/modelopt_quant.py
+2
-4
No files found.
python/sglang/srt/layers/moe/fused_moe_triton/layer.py
View file @
288ae41f
...
@@ -1063,10 +1063,15 @@ class FlashInferFP4MoE(FusedMoE):
...
@@ -1063,10 +1063,15 @@ class FlashInferFP4MoE(FusedMoE):
gemm1_weights_scale
=
self
.
gemm1_scales_fp4_shuffled
.
data
.
view
(
gemm1_weights_scale
=
self
.
gemm1_scales_fp4_shuffled
.
data
.
view
(
torch
.
float8_e4m3fn
torch
.
float8_e4m3fn
),
),
gemm1_bias
=
None
,
gemm1_alpha
=
None
,
gemm1_beta
=
None
,
gemm1_clamp_limit
=
None
,
gemm2_weights
=
self
.
gemm2_weights_fp4_shuffled
.
data
,
gemm2_weights
=
self
.
gemm2_weights_fp4_shuffled
.
data
,
gemm2_weights_scale
=
self
.
gemm2_scales_fp4_shuffled
.
data
.
view
(
gemm2_weights_scale
=
self
.
gemm2_scales_fp4_shuffled
.
data
.
view
(
torch
.
float8_e4m3fn
torch
.
float8_e4m3fn
),
),
gemm2_bias
=
None
,
output1_scale_scalar
=
self
.
g1_scale_c
.
data
,
output1_scale_scalar
=
self
.
g1_scale_c
.
data
,
output1_scale_gate_scalar
=
self
.
g1_alphas
.
data
,
output1_scale_gate_scalar
=
self
.
g1_alphas
.
data
,
output2_scale_scalar
=
self
.
g2_alphas
.
data
,
output2_scale_scalar
=
self
.
g2_alphas
.
data
,
...
...
python/sglang/srt/layers/quantization/modelopt_quant.py
View file @
288ae41f
...
@@ -764,8 +764,6 @@ class ModelOptNvFp4FusedMoEMethod(FusedMoEMethodBase):
...
@@ -764,8 +764,6 @@ class ModelOptNvFp4FusedMoEMethod(FusedMoEMethodBase):
)
)
# TODO(ch-wan): check if this is needed
# TODO(ch-wan): check if this is needed
layer
.
num_experts
=
num_experts
layer
.
num_local_experts
=
num_experts
layer
.
intermediate_size_per_partition
=
intermediate_size_per_partition
layer
.
intermediate_size_per_partition
=
intermediate_size_per_partition
layer
.
params_dtype
=
params_dtype
layer
.
params_dtype
=
params_dtype
layer
.
quant_config
=
self
.
quant_config
layer
.
quant_config
=
self
.
quant_config
...
@@ -1106,7 +1104,7 @@ class ModelOptNvFp4FusedMoEMethod(FusedMoEMethodBase):
...
@@ -1106,7 +1104,7 @@ class ModelOptNvFp4FusedMoEMethod(FusedMoEMethodBase):
layer
.
w13_weight_scale
,
layer
.
w13_weight_scale
,
)
)
print
(
"Applied flashinfer weight processing for both w13 and w2"
)
logger
.
info_once
(
"Applied flashinfer weight processing for both w13 and w2"
)
else
:
else
:
# CUTLASS processing - handle w13 and w2 separately
# CUTLASS processing - handle w13 and w2 separately
...
@@ -1126,7 +1124,7 @@ class ModelOptNvFp4FusedMoEMethod(FusedMoEMethodBase):
...
@@ -1126,7 +1124,7 @@ class ModelOptNvFp4FusedMoEMethod(FusedMoEMethodBase):
layer
.
w2_weight
=
Parameter
(
layer
.
w2_weight
.
data
,
requires_grad
=
False
)
layer
.
w2_weight
=
Parameter
(
layer
.
w2_weight
.
data
,
requires_grad
=
False
)
# Both flashinfer cutlass and regular cutlass use same processing for w2
# Both flashinfer cutlass and regular cutlass use same processing for w2
print
(
"Applied weight processing for both w13 and w2"
)
logger
.
info_once
(
"Applied weight processing for both w13 and w2"
)
# Set up CUTLASS MoE parameters
# Set up CUTLASS MoE parameters
device
=
layer
.
w13_weight
.
device
device
=
layer
.
w13_weight
.
device
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment