[MoE Refactor] Move the shared/fused expert output sum into MoERunnerBase (#35949)
Signed-off-by: Bill Nell <bnell@redhat.com> Co-authored-by: Robert Shaw <114415538+robertgshaw2-redhat@users.noreply.github.com>
This commit is contained in:
@@ -283,7 +283,6 @@ class AriaTextMoELayer(nn.Module):
|
||||
hidden_size=config.hidden_size,
|
||||
intermediate_size=config.intermediate_size,
|
||||
quant_config=quant_config,
|
||||
reduce_results=True,
|
||||
prefix=f"{prefix}.experts",
|
||||
)
|
||||
|
||||
@@ -301,12 +300,7 @@ class AriaTextMoELayer(nn.Module):
|
||||
|
||||
router_output = torch.nn.functional.linear(hidden_states, self.router_weight)
|
||||
|
||||
sparse_expert_output = self.experts(hidden_states, router_output)
|
||||
|
||||
if self.shared_experts is not None:
|
||||
return sparse_expert_output[0] + sparse_expert_output[1]
|
||||
else:
|
||||
return sparse_expert_output
|
||||
return self.experts(hidden_states, router_output)
|
||||
|
||||
|
||||
class AriaTextDecoderLayer(LlamaDecoderLayer):
|
||||
|
||||
Reference in New Issue
Block a user