Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
48d5985a
Unverified
Commit
48d5985a
authored
May 18, 2024
by
eigenLiu
Committed by
GitHub
May 17, 2024
Browse files
Sync huggingface modifications of qwen Moe model (#4774)
parent
33e0823d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
2 deletions
+9
-2
vllm/model_executor/models/qwen2_moe.py
vllm/model_executor/models/qwen2_moe.py
+9
-2
No files found.
vllm/model_executor/models/qwen2_moe.py
View file @
48d5985a
...
@@ -283,8 +283,9 @@ class Qwen2MoeDecoderLayer(nn.Module):
...
@@ -283,8 +283,9 @@ class Qwen2MoeDecoderLayer(nn.Module):
cache_config
=
cache_config
,
cache_config
=
cache_config
,
quant_config
=
quant_config
,
quant_config
=
quant_config
,
)
)
if
(
config
.
num_experts
is
not
None
if
(
layer_idx
not
in
config
.
mlp_only_layers
)
and
(
and
(
layer_idx
+
1
)
%
config
.
decoder_sparse_step
==
0
):
config
.
num_experts
>
0
and
(
layer_idx
+
1
)
%
config
.
decoder_sparse_step
==
0
):
self
.
mlp
=
Qwen2MoeSparseMoeBlock
(
config
=
config
,
self
.
mlp
=
Qwen2MoeSparseMoeBlock
(
config
=
config
,
quant_config
=
quant_config
)
quant_config
=
quant_config
)
else
:
else
:
...
@@ -439,6 +440,9 @@ class Qwen2MoeForCausalLM(nn.Module):
...
@@ -439,6 +440,9 @@ class Qwen2MoeForCausalLM(nn.Module):
if
((
"mlp.experts."
in
name
or
"mlp.shared_expert."
in
name
)
if
((
"mlp.experts."
in
name
or
"mlp.shared_expert."
in
name
)
and
name
not
in
params_dict
):
and
name
not
in
params_dict
):
continue
continue
if
name
not
in
params_dict
:
continue
param
=
params_dict
[
name
]
param
=
params_dict
[
name
]
weight_loader
=
param
.
weight_loader
weight_loader
=
param
.
weight_loader
weight_loader
(
param
,
loaded_weight
,
shard_id
)
weight_loader
(
param
,
loaded_weight
,
shard_id
)
...
@@ -451,6 +455,9 @@ class Qwen2MoeForCausalLM(nn.Module):
...
@@ -451,6 +455,9 @@ class Qwen2MoeForCausalLM(nn.Module):
if
((
"mlp.experts."
in
name
or
"mlp.shared_expert."
in
name
)
if
((
"mlp.experts."
in
name
or
"mlp.shared_expert."
in
name
)
and
name
not
in
params_dict
):
and
name
not
in
params_dict
):
continue
continue
if
name
not
in
params_dict
:
continue
param
=
params_dict
[
name
]
param
=
params_dict
[
name
]
weight_loader
=
getattr
(
param
,
"weight_loader"
,
weight_loader
=
getattr
(
param
,
"weight_loader"
,
default_weight_loader
)
default_weight_loader
)
...
...
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