DP Attention with Auto DeepEP Dispatch (#7222)
This commit is contained in:
@@ -229,7 +229,7 @@ class Qwen3MoeSparseMoeBlock(nn.Module):
|
||||
hidden_states=hidden_states,
|
||||
topk_idx=topk_idx,
|
||||
topk_weights=topk_weights,
|
||||
forward_mode=forward_mode,
|
||||
forward_batch=forward_batch,
|
||||
)
|
||||
final_hidden_states = self.experts(
|
||||
hidden_states=hidden_states,
|
||||
@@ -240,14 +240,14 @@ class Qwen3MoeSparseMoeBlock(nn.Module):
|
||||
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,
|
||||
)
|
||||
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,
|
||||
)
|
||||
return final_hidden_states
|
||||
|
||||
@@ -293,7 +293,7 @@ class Qwen3MoeSparseMoeBlock(nn.Module):
|
||||
hidden_states=state.pop("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,
|
||||
tbo_subbatch_index=state.get("tbo_subbatch_index"),
|
||||
)
|
||||
|
||||
@@ -325,7 +325,7 @@ class Qwen3MoeSparseMoeBlock(nn.Module):
|
||||
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,
|
||||
)
|
||||
|
||||
def op_combine_a(self, state):
|
||||
@@ -334,7 +334,7 @@ class Qwen3MoeSparseMoeBlock(nn.Module):
|
||||
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,
|
||||
tbo_subbatch_index=state.get("tbo_subbatch_index"),
|
||||
)
|
||||
|
||||
@@ -647,9 +647,7 @@ class Qwen3MoeDecoderLayer(nn.Module):
|
||||
|
||||
def op_mlp(self, state):
|
||||
hidden_states = state.pop("hidden_states_mlp_input")
|
||||
state.hidden_states_mlp_output = self.mlp(
|
||||
hidden_states, state.forward_batch.forward_mode
|
||||
)
|
||||
state.hidden_states_mlp_output = self.mlp(hidden_states, state.forward_batch)
|
||||
|
||||
def op_comm_postprocess_layer(self, state):
|
||||
hidden_states, residual = self.layer_communicator.postprocess_layer(
|
||||
|
||||
Reference in New Issue
Block a user