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
14d90617
Unverified
Commit
14d90617
authored
Feb 21, 2025
by
Chayenne
Committed by
GitHub
Feb 21, 2025
Browse files
Bug: fix lm head weights in Qwen models (#3777)
parent
d37f9551
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
3 deletions
+5
-3
python/sglang/srt/models/qwen2.py
python/sglang/srt/models/qwen2.py
+0
-2
python/sglang/srt/models/qwen2_rm.py
python/sglang/srt/models/qwen2_rm.py
+5
-1
No files found.
python/sglang/srt/models/qwen2.py
View file @
14d90617
...
@@ -379,8 +379,6 @@ class Qwen2ForCausalLM(nn.Module):
...
@@ -379,8 +379,6 @@ class Qwen2ForCausalLM(nn.Module):
continue
continue
if
name
.
startswith
(
"model.vision_tower"
)
and
name
not
in
params_dict
:
if
name
.
startswith
(
"model.vision_tower"
)
and
name
not
in
params_dict
:
continue
continue
if
name
.
startswith
(
"lm_head"
):
continue
for
param_name
,
weight_name
,
shard_id
in
stacked_params_mapping
:
for
param_name
,
weight_name
,
shard_id
in
stacked_params_mapping
:
if
weight_name
not
in
name
:
if
weight_name
not
in
name
:
...
...
python/sglang/srt/models/qwen2_rm.py
View file @
14d90617
...
@@ -62,7 +62,11 @@ class Qwen2ForRewardModel(nn.Module):
...
@@ -62,7 +62,11 @@ class Qwen2ForRewardModel(nn.Module):
return
EmbeddingPoolerOutput
(
pooled_logits
)
return
EmbeddingPoolerOutput
(
pooled_logits
)
def
load_weights
(
self
,
weights
:
Iterable
[
Tuple
[
str
,
torch
.
Tensor
]]):
def
load_weights
(
self
,
weights
:
Iterable
[
Tuple
[
str
,
torch
.
Tensor
]]):
return
Qwen2ForCausalLM
.
load_weights
(
self
,
weights
)
# Filter out lm_head weights of Qwen2ForCausalLM
filtered_weights
=
[
(
name
,
w
)
for
name
,
w
in
weights
if
not
name
.
startswith
(
"lm_head"
)
]
return
Qwen2ForCausalLM
.
load_weights
(
self
,
filtered_weights
)
EntryClass
=
[
EntryClass
=
[
...
...
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