[CI] Fix mypy for vllm/attention and vllm/compilation#26482
[CI] Fix mypy for vllm/attention and vllm/compilation#26482hmellor wants to merge 19 commits intovllm-project:mainfrom
vllm/attention and vllm/compilation#26482Conversation
This change brings us closer to not needing a custom `mypy` check. Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
ℹ️ About Codex in GitHub
Your team has set up Codex to 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 👍.
There was a problem hiding this comment.
Code Review
This pull request aims to fix mypy issues to enable stricter type checking. While most changes correctly add or refine type hints, I've identified a few regressions. Specifically, a logic change in vllm/attention/selector.py removes the fallback to a default attention backend, which could break existing setups. Additionally, the logic for determining the default compilation level in vllm/config/vllm.py appears to be inverted with respect to the enforce_eager flag. Lastly, a type hint in vllm/v1/attention/backends/utils.py was changed incorrectly, which could lead to runtime errors. These issues are of high and critical severity and should be addressed.
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
vllm/config/vllm.py
Outdated
| else: | ||
| assert self.compilation_config.level >= CompilationLevel.NO_COMPILATION | ||
| assert self.compilation_config.level <= CompilationLevel.PIECEWISE | ||
| assert self.compilation_config.level <= 3 |
There was a problem hiding this comment.
No longer needed because level is Field(default=None, ge=0, le=3) so Pydantic will catch it
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
| if not (self.model_config is None or self.model_config.enforce_eager): | ||
| self.compilation_config.mode = CompilationMode.VLLM_COMPILE |
There was a problem hiding this comment.
The logic seems to have changed here. Did V0 deprecation proceed to a point that we can make these changes?
There was a problem hiding this comment.
As far as I know, V0 is already gone
There was a problem hiding this comment.
I think I've lived under a rock for too long, you're right - using the v0 engine just imports the v1 engine it looks like.
Some of the tests were relying on this behavior, but as long as they pass we're good
There was a problem hiding this comment.
If any tests do rely on V0 defaults, I'll update them
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: Harry Mellor <19981378+hmellor@users.noreply.github.com>
…or/vllm into mypy-attention-compilation
|
This pull request has merge conflicts that must be resolved before it can be |
yewentao256
left a comment
There was a problem hiding this comment.
Please fix the pre-commit and conflicts so that we can land this PR
|
@hmellor are you still planning to merge this PR? |
|
I merged from main locally a few days ago, but have been focusing on Transformers v5 the past couple of weeks. Would you like to take over the compilation part? |
|
This change brings us closer to not needing a custom
mypycheck. Part of #26533