-
-
Notifications
You must be signed in to change notification settings - Fork 11.1k
[Core] Support custom executor qualname #23314
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
Conversation
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
|
👋 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 🚀 |
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 support for specifying a custom executor via its fully qualified name, which is a nice enhancement for framework integrations. The changes are mostly in vllm/v1/executor/abstract.py to handle the dynamic import, and in vllm/config/parallel.py to adjust the configuration validation. A new test file is also added to cover the new functionality. My review has identified a couple of high-severity issues. First, in vllm/v1/executor/abstract.py, there's a potential for an unhandled TypeError if the provided qualname resolves to a non-class object. Second, the validation change in the shared vllm/config/parallel.py file weakens validation for the v0 engine, which could lead to a confusing user experience. I've provided suggestions to address these points.
| if self.distributed_executor_backend is not None and not isinstance( | ||
| self.distributed_executor_backend, str) and not (isinstance( | ||
| self.distributed_executor_backend, type) and issubclass( | ||
| self.distributed_executor_backend, ExecutorBase)): | ||
| raise ValueError( | ||
| "Unrecognized distributed executor backend " | ||
| f"{self.distributed_executor_backend}. Supported " | ||
| "values are 'ray', 'mp' 'uni', 'external_launcher' or" | ||
| " custom ExecutorBase subclass.") | ||
| "values are 'ray', 'mp' 'uni', 'external_launcher', " | ||
| " custom ExecutorBase subclass or its import path.") |
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.
This change weakens the validation for the v0 engine. The v0 engine does not support custom executor paths (qualnames), but this new validation logic allows any string to pass. This can lead to confusing failures later in the initialization process for v0 users. Since this configuration file is shared between v0 and v1, this change is a regression for v0. Could we preserve the stricter validation for v0?
| if not issubclass(executor_class, ExecutorBase): | ||
| raise TypeError( | ||
| "distributed_executor_backend must be a subclass of " | ||
| f"ExecutorBase. Got {executor_class}.") |
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 call to issubclass will raise a TypeError if executor_class is not a class (e.g., if the user provides a qualname for a function or module). This would result in an unhandled exception. It's better to validate that executor_class is a type before checking if it's a subclass of ExecutorBase to provide a more user-friendly error message.
| if not issubclass(executor_class, ExecutorBase): | |
| raise TypeError( | |
| "distributed_executor_backend must be a subclass of " | |
| f"ExecutorBase. Got {executor_class}.") | |
| if not isinstance(executor_class, type) or not issubclass( | |
| executor_class, ExecutorBase): | |
| raise TypeError( | |
| "distributed_executor_backend must be a class and a subclass of " | |
| f"ExecutorBase. Got {executor_class}.") |
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.
false positive. resolve_obj_by_qualname will return the class or raise error within the function.
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com> Signed-off-by: root <xwq391974@alibaba-inc.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com> Signed-off-by: Xiao Yu <xiao.yu@amd.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Signed-off-by: 22quinn <33176974+22quinn@users.noreply.github.com>
Purpose
Some RL frameworks may define its own custom executor. This PR adds support for passing custom executor qual name via
vllm serveand dynamically import the actual class during runtime.Since v0 is on its way to be deprecated, we added v1 support only.
Test Plan
Unit test:
pytest -v tests/v1/executor/test_executor.pyServing:
vllm serve Qwen/Qwen3-0.6B --enforce-eager --distributed-executor-backend="tests.v1.executor.test_executor.CustomMultiprocExecutor"Test Result
Passed
(Optional) Documentation Update
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.