-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
[CI] Fix mypy for vllm/v1/core and vllm/v1/engine
#27108
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: yewentao256 <[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 introduces fixes to address mypy errors in vllm/v1/core and vllm/v1/engine. The changes primarily involve adding type hints, explicit casts, and safer attribute access patterns to improve type safety and satisfy mypy checks.
I've found one critical issue in vllm/v1/engine/llm_engine.py where the new logic for processing request outputs can lead to data loss by incorrectly filtering a list of mixed-type results. I've provided a detailed comment and a suggested fix for this issue.
Other changes appear correct and effectively address the mypy errors.
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.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR.
Signed-off-by: yewentao256 <[email protected]>
|
@hmellor CC |
|
|
||
| async def is_tracing_enabled(self) -> bool: | ||
| return self.observability_config.otlp_traces_endpoint is not None | ||
| return self.observability_config.otlp_traces_endpoint is not None # type: ignore |
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.
Why does the type need to be ignored here? Should this not always return a bool?
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 issue is vllm/v1/engine/async_llm.py:661: error: Item "None" of "ObservabilityConfig | None" has no attribute "otlp_traces_endpoint" [union-attr]
async def is_tracing_enabled(self) -> bool:
assert self.observability_config is not None
return self.observability_config.otlp_traces_endpoint is not NoneI think this is not very elegant so just #type ignore
vllm/v1/engine/core.py
Outdated
| if hasattr(self.model_executor, "save_tensorized_model"): | ||
| self.model_executor.save_tensorized_model( # type: ignore[attr-defined] | ||
| tensorizer_config=tensorizer_config, | ||
| ) |
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 should probably error if we if the model executor doesn't have this method
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.
Just to confirm, you meant we should raise an error here in case the model executor doesn't have this method?
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: yewentao256 <[email protected]>
Signed-off-by: yewentao256 <[email protected]>
Signed-off-by: yewentao256 <[email protected]>
|
Hi @hmellor, wondering is there anything else we should update? |
|
This PR is failing pre-commit on main |
|
@DarkLight1337 this wasn't force-merged right? Can we still break pre-commit with a clean-merge..? |
|
It wasn't. But this PR was behind main when it was merged. |
…7108) Signed-off-by: yewentao256 <[email protected]>
|
😢 |
|
@DarkLight1337 Is there any way we can avoid this? A clean merge shouldn't cause trouble to CI |
|
It happens when a PR changes a pre-commit rule.
The best way to prevent this is to always merge from main before attempting to merge a PR which changes pre-commit rules. |
…7108) Signed-off-by: yewentao256 <[email protected]>
…7108) Signed-off-by: yewentao256 <[email protected]>
…7108) Signed-off-by: yewentao256 <[email protected]>
…7108) Signed-off-by: yewentao256 <[email protected]> Signed-off-by: Eldar Kurtic <[email protected]>
…7108) Signed-off-by: yewentao256 <[email protected]>
Purpose
Part of #26533
FIx mypy for
vllm/v1/coreandvllm/v1/engine@hmellor CC
Test
pre-commit run --hook-stage manual mypy-3.10 -a Run mypy for Python 3.10.................................................Passed