Skip to content
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

Add renormalize parameter for FusedMOE's & modify experts_max arg of mixture_of_experts() #70

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

tangleintel
Copy link

  1. Add renormalize parameter for FusedMOE cause whether to normalize routing_weights depends on the norm_topk_prob attrib in model's config.json file. Some models such as Qwen2-MoE is set to false.
  2. The experts_max param is inclusive according to the habana's doc

@@ -357,30 +357,32 @@ def forward(self, state, expert_id, w):
return torch.matmul(state, w[expert_id].transpose(0, 1))


def calculate_routing_tensors(score, topk, hidden_states_dtype):
def calculate_routing_tensors(score, topk, hidden_states_dtype, renormalize: bool = True):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add a small test for this to vllm-fork ci?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I found it's hard to demonstrate this with a UT cause it's depends on the real model with trained weights and see what's the different of the generated contents with and without this PR. We can refer to optimum habana's results and CUDA's results. But I think its's not realistic to put them into the UT. Do you have any suggestions ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We define tests in https://github.com/HabanaAI/vllm-fork/blob/habana_main/.jenkins/test_config.yaml please refer to configuration file to see possible invocation of a small test for fusedMoE with renormalize True and False

@@ -357,30 +357,32 @@ def forward(self, state, expert_id, w):
return torch.matmul(state, w[expert_id].transpose(0, 1))


def calculate_routing_tensors(score, topk, hidden_states_dtype):
def calculate_routing_tensors(score, topk, hidden_states_dtype, renormalize: bool = True):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We define tests in https://github.com/HabanaAI/vllm-fork/blob/habana_main/.jenkins/test_config.yaml please refer to configuration file to see possible invocation of a small test for fusedMoE with renormalize True and False

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants