Skip to content

Fix bug of expert init #10347

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions paddlenlp/transformers/deepseek_v2/modeling.py
Original file line number Diff line number Diff line change
Expand Up @@ -2238,6 +2238,13 @@ def _init_weights(self, layer):
if isinstance(layer, MoEGate):
kaiming_uniform_(layer.weight, a=math.sqrt(5))

moe_grad_group = fleet.get_hybrid_communicate_group().expert_grad_comm_group
if moe_grad_group is not None and moe_grad_group.nranks > 1:
for p in layer.parameters():
if hasattr(p, "color") and "color" in p.color:
if p.color["color"] == "moe_expert":
paddle.distributed.broadcast(p, src=moe_grad_group.ranks[0], group=moe_grad_group)

def step_flex_token(self, cur_step):
set_global_step(cur_step)

Expand Down
Loading