mirror of
https://github.com/PaddlePaddle/FastDeploy.git
synced 2026-04-23 08:21:53 +08:00
[Feature] Support redundant expert for eplb (#5918)
* [BugFix] support redundant expert for eplb * support redundant expert for eplb * support redundant expert for eplb * update * fix ci eplb
This commit is contained in:
@@ -252,8 +252,13 @@ def load_ep_checkpoint(cls: PretrainedModel, model_path: str, fd_config: FDConfi
|
||||
"mtp_block" if getattr(fd_config.speculative_config, "model_type", "main") == "mtp" else "layers"
|
||||
)
|
||||
|
||||
moe_num_experts = fd_config.model_config.moe_num_experts
|
||||
if isinstance(moe_num_experts, list):
|
||||
moe_num_experts = moe_num_experts[0]
|
||||
for i in range(fd_config.model_config.moe_layer_start_index, fd_config.model_config.num_hidden_layers):
|
||||
for j in get_expert_ranges(fd_config):
|
||||
# Map redundant expert IDs back to actual expert IDs for weight loading
|
||||
j = j % moe_num_experts
|
||||
up_gate_proj_key = f"ernie.{prefix_layer_name}.{i}.mlp.experts.{j}.up_gate_proj.weight"
|
||||
down_proj_key = f"ernie.{prefix_layer_name}.{i}.mlp.experts.{j}.down_proj.weight"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user