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
2df532ef
Unverified
Commit
2df532ef
authored
Sep 14, 2025
by
fzyzcjy
Committed by
GitHub
Sep 14, 2025
Browse files
Fix the global scale fix does not support EPLB and improve enabling condition (#10369)
parent
abea9250
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
10 deletions
+8
-10
python/sglang/srt/layers/moe/fused_moe_triton/layer.py
python/sglang/srt/layers/moe/fused_moe_triton/layer.py
+6
-10
python/sglang/srt/layers/quantization/modelopt_quant.py
python/sglang/srt/layers/quantization/modelopt_quant.py
+2
-0
No files found.
python/sglang/srt/layers/moe/fused_moe_triton/layer.py
View file @
2df532ef
...
...
@@ -504,14 +504,8 @@ class FusedMoE(torch.nn.Module):
param
.
data
[:,
:
dim1
,
:
dim2
].
copy_
(
loaded_weight
)
return
# ModelOptNvFp4FusedMoEMethod uses max of global expert scaling factors for input scaling factor
load_global_experts
=
(
isinstance
(
self
.
quant_method
,
ModelOptNvFp4FusedMoEMethod
)
and
"input_scale"
in
weight_name
)
global_expert_location_metadata
=
get_global_expert_location_metadata
()
if
global_expert_location_metadata
is
None
or
load_global_experts
:
if
global_expert_location_metadata
is
None
:
self
.
_weight_loader_impl
(
param
=
param
,
loaded_weight
=
loaded_weight
,
...
...
@@ -548,10 +542,12 @@ class FusedMoE(torch.nn.Module):
shard_id
:
str
,
expert_id
:
int
,
)
->
None
:
# WARN: This makes the `expert_id` mean "local" and "global" in different cases
if
not
getattr
(
param
,
"_sglang_require_global_experts"
,
False
):
expert_id
=
self
.
_map_global_expert_id_to_local_expert_id
(
expert_id
)
if
expert_id
==
-
1
:
return
expert_id
=
self
.
_map_global_expert_id_to_local_expert_id
(
expert_id
)
if
expert_id
==
-
1
:
return
self
.
_weight_loader_impl
(
param
=
param
,
loaded_weight
=
loaded_weight
,
...
...
python/sglang/srt/layers/quantization/modelopt_quant.py
View file @
2df532ef
...
...
@@ -999,12 +999,14 @@ class ModelOptNvFp4FusedMoEMethod(FusedMoEMethodBase):
data
=
torch
.
empty
(
layer
.
num_experts
,
2
,
dtype
=
torch
.
float32
),
weight_loader
=
weight_loader
,
)
w13_input_scale
.
_sglang_require_global_experts
=
True
layer
.
register_parameter
(
"w13_input_scale"
,
w13_input_scale
)
w2_input_scale
=
PerTensorScaleParameter
(
data
=
torch
.
empty
(
layer
.
num_experts
,
dtype
=
torch
.
float32
),
weight_loader
=
weight_loader
,
)
w2_input_scale
.
_sglang_require_global_experts
=
True
layer
.
register_parameter
(
"w2_input_scale"
,
w2_input_scale
)
def
swizzle_blockscale
(
self
,
scale
:
torch
.
Tensor
):
...
...
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