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
162f3ccb
Unverified
Commit
162f3ccb
authored
Aug 13, 2024
by
Ke Bao
Committed by
GitHub
Aug 13, 2024
Browse files
Fix layernorm input shape (#1066)
Co-authored-by:
Yineng Zhang
<
me@zhyncs.com
>
parent
65e89bae
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
4 deletions
+5
-4
python/sglang/srt/models/deepseek_v2.py
python/sglang/srt/models/deepseek_v2.py
+5
-4
No files found.
python/sglang/srt/models/deepseek_v2.py
View file @
162f3ccb
...
@@ -445,11 +445,12 @@ class DeepseekV2AttentionMLA(nn.Module):
...
@@ -445,11 +445,12 @@ class DeepseekV2AttentionMLA(nn.Module):
q_nope_out
=
q_input
[...,
:
self
.
kv_lora_rank
]
q_nope_out
=
q_input
[...,
:
self
.
kv_lora_rank
]
torch
.
bmm
(
q_nope
.
transpose
(
0
,
1
),
self
.
w_kc
,
out
=
q_nope_out
.
transpose
(
0
,
1
))
torch
.
bmm
(
q_nope
.
transpose
(
0
,
1
),
self
.
w_kc
,
out
=
q_nope_out
.
transpose
(
0
,
1
))
k_input
=
self
.
kv_a_proj_with_mqa
(
hidden_states
)[
0
]
.
unsqueeze
(
1
)
latent_cache
=
self
.
kv_a_proj_with_mqa
(
hidden_states
)[
0
]
k_pe
=
k_input
[...,
self
.
kv_lora_rank
:
]
v_input
=
latent_cache
[...,
:
self
.
kv_lora_rank
]
v_input
=
k_input
[...,
:
self
.
kv_lora_rank
]
v_input
=
self
.
kv_a_layernorm
(
v_input
.
contiguous
()).
unsqueeze
(
1
)
v
_input
=
self
.
kv_a_layernorm
(
v_input
.
contiguous
()
)
k
_input
=
latent_cache
.
unsqueeze
(
1
)
k_input
[...,
:
self
.
kv_lora_rank
]
=
v_input
k_input
[...,
:
self
.
kv_lora_rank
]
=
v_input
k_pe
=
k_input
[...,
self
.
kv_lora_rank
:]
q_pe
,
k_pe
=
self
.
rotary_emb
(
positions
,
q_pe
,
k_pe
)
q_pe
,
k_pe
=
self
.
rotary_emb
(
positions
,
q_pe
,
k_pe
)
q_input
[...,
self
.
kv_lora_rank
:]
=
q_pe
q_input
[...,
self
.
kv_lora_rank
:]
=
q_pe
...
...
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