-
Notifications
You must be signed in to change notification settings - Fork 48
Optimized MoE on Gaudi #159
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: gyou2021 <[email protected]>
wpyszka
left a comment
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.
lgtm
Signed-off-by: gyou2021 <[email protected]>
Signed-off-by: gyou2021 <[email protected]>
Signed-off-by: gyou2021 <[email protected]>
vllm_hpu_extension/ops.py
Outdated
| current_hidden_states_static = torch.matmul( | ||
| current_state_static, self.w2_weight.transpose( | ||
| 1, 2)) * padded_weights | ||
| final_hidden_states = current_hidden_states_static.sum(dim=0) |
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.
how about wrap static_moe as a function and invoke here?
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.
The INC engineer suggested not to wrap it.
Signed-off-by: gyou2021 <[email protected]>
Signed-off-by: gyou2021 <[email protected]>
Signed-off-by: gyou2021 <[email protected]>
Signed-off-by: gyou2021 <[email protected]>
…; added static moe. Signed-off-by: gyou2021 <[email protected]>
| final_hidden_states = slice_final_hidden_states | ||
| else: | ||
| final_hidden_states += slice_final_hidden_states | ||
| else: |
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.
don't use else. wrap static moe into a function and do:
if ...:
return static_MOE()
#existing code
...
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.
Modified.
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.
May you switch the sequence,
do:
if ...:
return static_MOE()
existing codes
dynamic_moe()
instead of:
if ...:
dynamic_moe()
else:
return statc
Signed-off-by: gyou2021 <[email protected]>
Signed-off-by: gyou2021 <[email protected]>
| # dynamic MoE is used since its performance is better than | ||
| # static MoE in this case. | ||
| self.dynamic_moe_min_tokens = int( | ||
| os.environ.get("VLLM_DYNAMIC_MOE_MIN_TOKENS", 256)) |
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.
isn't this duplicated with 466 - 482?
=== update 05/13 ===
need refactoring current impl to work both bf16 and fp8 static moe
TODO:
Not need to move it as a new module according to the consultation with the INC engineer.