-
-
Notifications
You must be signed in to change notification settings - Fork 11.3k
[Misc] Minor enhancement of benchmark_moe #22068
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
[Misc] Minor enhancement of benchmark_moe #22068
Conversation
Signed-off-by: Jee Jee Li <[email protected]>
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.
Code Review
This pull request adds a check to ensure intermediate_size is divisible by the tensor parallelism size in the MoE benchmark, which is a good correctness fix. My review focuses on improving the implementation of this check. I've suggested inlining the assertion, which simplifies the code and removes a new helper function that has a misleading generic name for a specific purpose.
| def ensure_divisibility(numerator, denominator): | ||
| """Ensure that numerator is divisible by the denominator.""" | ||
| assert numerator % denominator == 0, ( | ||
| "intermediate_size {} is not divisible by tp {}.".format(numerator, denominator) | ||
| ) | ||
|
|
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.
| intermediate_size = config.intermediate_size | ||
| shard_intermediate_size = 2 * intermediate_size // args.tp_size | ||
|
|
||
| ensure_divisibility(intermediate_size, args.tp_size) |
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.
Inlining the divisibility check here makes the code more direct and removes the need for a separate helper function.
| ensure_divisibility(intermediate_size, args.tp_size) | |
| assert intermediate_size % args.tp_size == 0, f"intermediate_size {intermediate_size} is not divisible by tp {args.tp_size}" |
|
👋 Hi! Thank you for contributing to the vLLM project. 💬 Join our developer Slack at https://slack.vllm.ai to discuss your PR in #pr-reviews, coordinate on features in #feat- channels, or join special interest groups in #sig- channels. Just a reminder: PRs would not trigger full CI run by default. Instead, it would only run Once the PR is approved and ready to go, your PR reviewer(s) can run CI to test the changes comprehensively before merging. To run CI, PR reviewers can either: Add 🚀 |
Signed-off-by: Jee Jee Li <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]> Signed-off-by: Jinzhen Lin <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]> Signed-off-by: Noam Gat <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]> Signed-off-by: Paul Pak <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]> Signed-off-by: Diego-Castan <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]>
Signed-off-by: Jee Jee Li <[email protected]>
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.Purpose
The current code doesn't check whether
intermediate_sizecan be evenly divided by TP, which may lead to generating some useless configs. This PR mainly ensures thatintermediate_sizecan be divided by TP.Test Plan
Test Result
(Optional) Documentation Update