"vscode:/vscode.git/clone" did not exist on "153ba7f0f3d882c4feb84cea63b6a4e9618c9537"
Commit 4a946680 authored by zhuwenwen's avatar zhuwenwen
Browse files

[BugFix]支持v1 engine pp deepseek

parent 6a7954f4
...@@ -766,14 +766,17 @@ class DeepseekV2ForCausalLM(nn.Module, SupportsPP, MixtureOfExperts): ...@@ -766,14 +766,17 @@ class DeepseekV2ForCausalLM(nn.Module, SupportsPP, MixtureOfExperts):
self.num_expert_groups = config.n_group self.num_expert_groups = config.n_group
self.moe_layers: list[FusedMoE] = [] self.moe_layers: list[FusedMoE] = []
example_moe = None
for layer in self.model.layers: for layer in self.model.layers:
if isinstance(layer, PPMissingLayer):
continue
assert isinstance(layer, DeepseekV2DecoderLayer) assert isinstance(layer, DeepseekV2DecoderLayer)
if isinstance(layer.mlp, DeepseekV2MoE): if isinstance(layer.mlp, DeepseekV2MoE):
example_moe = layer.mlp
self.moe_layers.append(layer.mlp.experts) self.moe_layers.append(layer.mlp.experts)
# Pick last one layer since the first ones may be dense layers. # Pick last one layer since the first ones may be dense layers.
example_moe = typing.cast(
DeepseekV2MoE, self.model.layers[config.num_hidden_layers - 1].mlp)
self.num_logical_experts = example_moe.n_logical_experts self.num_logical_experts = example_moe.n_logical_experts
self.num_physical_experts = example_moe.n_physical_experts self.num_physical_experts = example_moe.n_physical_experts
self.num_local_physical_experts = example_moe.n_local_physical_experts self.num_local_physical_experts = example_moe.n_local_physical_experts
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment