Skip to content

Commit 0f27bd8

Browse files
fix missing param
1 parent 12d5c09 commit 0f27bd8

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

fastdeploy/model_executor/layers/moe/moe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ def load_state_dict(self, state_dict, is_rearrange: bool = False):
573573
else:
574574
self.quant_method.process_loaded_weights(self, state_dict)
575575

576-
def forward_split_allgather(self, x: paddle.Tensor, gate: nn.Layer):
576+
def forward_split_allgather(self, x: paddle.Tensor, gate: nn.Layer, forward_meta: ForwardMeta):
577577
"""
578578
Forward split allgather function.
579579
"""
@@ -588,7 +588,7 @@ def forward_split_allgather(self, x: paddle.Tensor, gate: nn.Layer):
588588
if end_offset > token_num:
589589
end_offset = token_num
590590
part_x[: (end_offset - start_offset), :] = x[start_offset:end_offset, :]
591-
out = self.quant_method.apply(self, part_x, gate)
591+
out = self.quant_method.apply(self, part_x, gate, forward_meta)
592592
multi_outs = paddle.zeros([token_num_per_rank * self.tp_size, x.shape[1]], dtype=x.dtype)
593593
paddle.distributed.all_gather(multi_outs, out, self.tp_group)
594594
out = multi_outs[:token_num, :]

fastdeploy/model_executor/models/deepseek_v3.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -189,8 +189,8 @@ def load_state_dict(self, state_dict):
189189

190190
def forward(self, hidden_states: paddle.Tensor, forward_meta: ForwardMeta):
191191
""" """
192-
shared_experts_out = self.shared_experts(hidden_states)
193-
moe_out = self.experts(hidden_states, self.gate)
192+
shared_experts_out = self.shared_experts(hidden_states, forward_meta)
193+
moe_out = self.experts(hidden_states, self.gate, forward_meta)
194194
moe_out = moe_out + shared_experts_out
195195
# We do to TP all reduce after the sum of experts.
196196
if self.tp_size > 1:

fastdeploy/model_executor/models/ernie4_5_moe.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ def forward(
224224
forward_meta=forward_meta,
225225
)
226226
if self.num_shared_experts > 0:
227-
s_x = self.shared_experts(hidden_states)
227+
s_x = self.shared_experts(hidden_states, forward_meta)
228228
out = out + s_x
229229
return out
230230

@@ -353,8 +353,8 @@ def forward(
353353
)
354354

355355
hidden_states = self.mlp(
356-
forward_meta=forward_meta,
357356
hidden_states=hidden_states,
357+
forward_meta=forward_meta,
358358
)
359359

360360
return hidden_states, residual

fastdeploy/model_executor/models/ernie4_5_vl/ernie4_5_vl_moe.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -271,7 +271,7 @@ def load_state_dict(self, state_dict):
271271

272272
def forward(self, hidden_states: paddle.Tensor, forward_meta: ForwardMeta, vl_moe_meta: VLMoEMeta):
273273
if self.num_shared_experts > 0:
274-
shared_experts_out = self.shared_experts(hidden_states)
274+
shared_experts_out = self.shared_experts(hidden_states, forward_meta)
275275
hidden_states, text_input, image_input = text_image_gather_scatter(
276276
hidden_states,
277277
vl_moe_meta.text_input,

0 commit comments

Comments
 (0)