-
Notifications
You must be signed in to change notification settings - Fork 5.1k
DP Attention with Auto DeepEP Dispatch #7222
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
Changes from 8 commits
0694048
b8c560e
f963bf6
3e7efd9
f381c81
9066d27
adf37cb
3ca3078
67dc83e
1129753
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -558,7 +558,7 @@ def forward_deepep( | |
| hidden_states=hidden_states, | ||
| topk_idx=topk_idx, | ||
| topk_weights=topk_weights, | ||
| forward_mode=forward_mode, | ||
| forward_batch=forward_batch, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. nit: wondering whether we should change the same thing in Qwen and other models |
||
| ) | ||
| final_hidden_states = self.experts( | ||
| hidden_states=hidden_states, | ||
|
|
@@ -569,14 +569,14 @@ def forward_deepep( | |
| masked_m=masked_m, | ||
| expected_m=expected_m, | ||
| num_recv_tokens_per_expert=num_recv_tokens_per_expert, | ||
| forward_mode=forward_mode, | ||
| forward_batch=forward_batch, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ) | ||
| if self.ep_size > 1: | ||
| final_hidden_states = self.deepep_dispatcher.combine( | ||
| hidden_states=final_hidden_states, | ||
| topk_idx=topk_idx, | ||
| topk_weights=topk_weights, | ||
| forward_mode=forward_mode, | ||
| forward_batch=forward_batch, | ||
| ) | ||
|
|
||
| if shared_output is not None: | ||
|
|
@@ -651,7 +651,7 @@ def op_dispatch_a(self, state): | |
| hidden_states=state.hidden_states_mlp_input, | ||
| topk_idx=state.pop("topk_idx_local"), | ||
| topk_weights=state.pop("topk_weights_local"), | ||
| forward_mode=state.forward_batch.forward_mode, | ||
| forward_batch=state.forward_batch, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| tbo_subbatch_index=state.get("tbo_subbatch_index"), | ||
| ) | ||
|
|
||
|
|
@@ -683,7 +683,7 @@ def op_experts(self, state): | |
| masked_m=state.pop("masked_m"), | ||
| expected_m=state.pop("expected_m"), | ||
| num_recv_tokens_per_expert=state.pop("num_recv_tokens_per_expert"), | ||
| forward_mode=state.forward_batch.forward_mode, | ||
| forward_batch=state.forward_batch, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ) | ||
|
|
||
| def op_combine_a(self, state): | ||
|
|
@@ -692,7 +692,7 @@ def op_combine_a(self, state): | |
| hidden_states=state.pop("hidden_states_experts_output"), | ||
| topk_idx=state.pop("topk_idx_dispatched"), | ||
| topk_weights=state.pop("topk_weights_dispatched"), | ||
| forward_mode=state.forward_batch.forward_mode, | ||
| forward_batch=state.forward_batch, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| tbo_subbatch_index=state.get("tbo_subbatch_index"), | ||
| ) | ||
|
|
||
|
|
@@ -1886,7 +1886,7 @@ def op_mlp(self, state): | |
| and hidden_states.shape[0] == 0 | ||
| ): | ||
| state.hidden_states_mlp_output = self.mlp( | ||
| hidden_states, state.forward_batch.forward_mode | ||
| hidden_states, state.forward_batch | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
| ) | ||
| else: | ||
| state.hidden_states_mlp_output = hidden_states | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Consider renaming
forward_batchtoforward_batch_infofor clarity.