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
zhaoyu6
sglang
Commits
e3c4bd31
"llm/llama.cpp/gguf-py/scripts/gguf_dump.py" did not exist on "b0135f4b9b176eab9155b660d04c9ca2a1ec2341"
Unverified
Commit
e3c4bd31
authored
Apr 10, 2025
by
fzyzcjy
Committed by
GitHub
Apr 09, 2025
Browse files
Fix DeepSeek error when using DeepEP mode (#5190)
parent
5db37c86
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
python/sglang/srt/models/deepseek_v2.py
python/sglang/srt/models/deepseek_v2.py
+8
-6
No files found.
python/sglang/srt/models/deepseek_v2.py
View file @
e3c4bd31
...
...
@@ -280,10 +280,7 @@ class DeepseekV2MoE(nn.Module):
return
self
.
forward_deepep
(
hidden_states
,
forward_mode
)
def
forward_normal
(
self
,
hidden_states
:
torch
.
Tensor
)
->
torch
.
Tensor
:
if
self
.
n_shared_experts
is
not
None
and
self
.
n_share_experts_fusion
==
0
:
shared_output
=
self
.
shared_experts
(
hidden_states
)
else
:
shared_output
=
None
shared_output
=
self
.
_forward_shared_experts
(
hidden_states
)
# router_logits: (num_tokens, n_experts)
router_logits
=
self
.
gate
(
hidden_states
)
final_hidden_states
=
(
...
...
@@ -313,8 +310,7 @@ class DeepseekV2MoE(nn.Module):
):
# router_logits: (num_tokens, n_experts)
router_logits
=
self
.
gate
(
hidden_states
)
if
self
.
n_shared_experts
is
not
None
:
shared_output
=
self
.
shared_experts
(
hidden_states
)
shared_output
=
self
.
_forward_shared_experts
(
hidden_states
)
topk_weights
,
topk_idx
=
select_experts
(
hidden_states
=
hidden_states
,
router_logits
=
router_logits
,
...
...
@@ -364,6 +360,12 @@ class DeepseekV2MoE(nn.Module):
return
final_hidden_states
def
_forward_shared_experts
(
self
,
hidden_states
):
if
self
.
n_shared_experts
is
not
None
and
self
.
n_share_experts_fusion
==
0
:
return
self
.
shared_experts
(
hidden_states
)
else
:
return
None
def
yarn_get_mscale
(
scale
:
float
=
1
,
mscale
:
float
=
1
)
->
float
:
import
math
...
...
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