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
e9feb488
Unverified
Commit
e9feb488
authored
May 22, 2025
by
Zilin Zhu
Committed by
GitHub
May 21, 2025
Browse files
[RL] Remove the w13 weight_scale and input_scale for UnquantizedEPMoE… (#6308)
parent
fc992a09
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
14 deletions
+5
-14
python/sglang/srt/layers/moe/ep_moe/layer.py
python/sglang/srt/layers/moe/ep_moe/layer.py
+5
-14
No files found.
python/sglang/srt/layers/moe/ep_moe/layer.py
View file @
e9feb488
...
@@ -497,7 +497,8 @@ class EPMoE(torch.nn.Module):
...
@@ -497,7 +497,8 @@ class EPMoE(torch.nn.Module):
# Input scales can be loaded directly and should be equal.
# Input scales can be loaded directly and should be equal.
if
"input_scale"
in
weight_name
:
if
"input_scale"
in
weight_name
:
if
(
if
(
param_data
[
expert_id
]
!=
1
(
shard_id
==
"w1"
or
shard_id
==
"w3"
)
and
param_data
[
expert_id
]
!=
1
and
(
param_data
[
expert_id
]
-
loaded_weight
).
abs
()
>
1e-5
and
(
param_data
[
expert_id
]
-
loaded_weight
).
abs
()
>
1e-5
):
):
raise
ValueError
(
raise
ValueError
(
...
@@ -571,13 +572,10 @@ class UnquantizedEPMoEMethod(FusedMoEMethodBase, CustomOp):
...
@@ -571,13 +572,10 @@ class UnquantizedEPMoEMethod(FusedMoEMethodBase, CustomOp):
set_weight_attrs
(
w2_weight
,
extra_weight_attrs
)
set_weight_attrs
(
w2_weight
,
extra_weight_attrs
)
# scale
# scale
layer
.
register_parameter
(
"w13_input_scale"
,
None
)
layer
.
register_parameter
(
"w13_weight_scale"
,
None
)
ones_tensor
=
torch
.
ones
(
num_experts_per_partition
,
dtype
=
torch
.
float32
)
ones_tensor
=
torch
.
ones
(
num_experts_per_partition
,
dtype
=
torch
.
float32
)
w13_input_scale
=
torch
.
nn
.
Parameter
(
ones_tensor
,
requires_grad
=
False
,
)
layer
.
register_parameter
(
"w13_input_scale"
,
w13_input_scale
)
set_weight_attrs
(
w13_input_scale
,
extra_weight_attrs
)
w2_input_scale
=
torch
.
nn
.
Parameter
(
w2_input_scale
=
torch
.
nn
.
Parameter
(
ones_tensor
,
ones_tensor
,
...
@@ -586,13 +584,6 @@ class UnquantizedEPMoEMethod(FusedMoEMethodBase, CustomOp):
...
@@ -586,13 +584,6 @@ class UnquantizedEPMoEMethod(FusedMoEMethodBase, CustomOp):
layer
.
register_parameter
(
"w2_input_scale"
,
w2_input_scale
)
layer
.
register_parameter
(
"w2_input_scale"
,
w2_input_scale
)
set_weight_attrs
(
w2_input_scale
,
extra_weight_attrs
)
set_weight_attrs
(
w2_input_scale
,
extra_weight_attrs
)
w13_weight_scale
=
torch
.
nn
.
Parameter
(
ones_tensor
,
requires_grad
=
False
,
)
layer
.
register_parameter
(
"w13_weight_scale"
,
w13_weight_scale
)
set_weight_attrs
(
w13_weight_scale
,
extra_weight_attrs
)
w2_weight_scale
=
torch
.
nn
.
Parameter
(
w2_weight_scale
=
torch
.
nn
.
Parameter
(
ones_tensor
,
ones_tensor
,
requires_grad
=
False
,
requires_grad
=
False
,
...
...
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