[Bugfix] Fix 2 precommit issues - (mamba_block_size, kv_cache_config)#27811
[Bugfix] Fix 2 precommit issues - (mamba_block_size, kv_cache_config)#27811
Conversation
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
| return | ||
|
|
||
| # Save the user input before it gets modified by MambaModelConfig | ||
| mamba_block_size = vllm_config.cache_config.mamba_block_size |
There was a problem hiding this comment.
There was a problem hiding this comment.
#27289 (comment) is the specific thread with the explanation
There was a problem hiding this comment.
Code Review
This pull request addresses two pre-commit issues. The removal of the unused mamba_block_size variable in vllm/model_executor/models/config.py is a good cleanup. However, the change in vllm/v1/core/sched/scheduler.py introduces a critical bug. It attempts to fix a potential linting issue by assigning an object of type KVCacheConfig to an attribute that expects a CacheConfig object. This will likely lead to runtime errors. I've left a comment with a suggestion to revert this change.
vllm/v1/core/sched/scheduler.py
Outdated
|
|
||
| connector_vllm_config = copy.copy(self.vllm_config) | ||
| connector_vllm_config.kv_cache_config = copy.copy(kv_cache_config) | ||
| connector_vllm_config.cache_config = copy.copy(kv_cache_config) |
There was a problem hiding this comment.
This change appears to introduce a type error. The connector_vllm_config is an instance of VllmConfig, which has a cache_config attribute of type CacheConfig. The kv_cache_config variable is of type KVCacheConfig. These two types are not compatible.
Assigning kv_cache_config to connector_vllm_config.cache_config will likely cause AttributeError exceptions downstream in any code that expects a CacheConfig object, as their attributes are different. For example, CacheConfig has block_size and cache_dtype, while KVCacheConfig has num_blocks and kv_cache_groups.
The previous code connector_vllm_config.kv_cache_config = copy.copy(kv_cache_config) was dynamically adding an attribute, which is allowed but might have been flagged by a linter. If the connector expects a kv_cache_config attribute, the previous implementation was functionally correct. This change seems to fix a linting issue by introducing a runtime bug.
I suggest reverting this change and potentially adding a # type: ignore or # noqa to address the linting warning if that was the original problem.
| connector_vllm_config.cache_config = copy.copy(kv_cache_config) | |
| connector_vllm_config.kv_cache_config = copy.copy(kv_cache_config) |
Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com>
vllm/v1/core/sched/scheduler.py
Outdated
|
|
||
| connector_vllm_config = copy.copy(self.vllm_config) | ||
| connector_vllm_config.kv_cache_config = copy.copy(kv_cache_config) | ||
| connector_vllm_config.cache_config = copy.copy(kv_cache_config) |
There was a problem hiding this comment.
|
Some other pre-commit errors are caused by #27108, we can fix them separately |
|
@GuanLuo had a similar one |
vllm/v1/core/sched/scheduler.py
Outdated
There was a problem hiding this comment.
| return self.connector.request_finished(request, block_ids) # type: ignore[attr-defined] |
Should be able to just ignore the type check here, this line will not be hit at the current state (no connector implements HMA interface).
For future reference, I think request_finished_all_groups should be called here as it is defined in SupportHMA interface and has the correct function signature.
There was a problem hiding this comment.
Switched to request_finished_all_groups
yewentao256
left a comment
There was a problem hiding this comment.
LGTM, thanks for the fix!
Co-authored-by: Nick Hill <nhill@redhat.com> Signed-off-by: Tyler Michael Smith <tysmith@redhat.com>
|
Force merge to unbreak main |
…vllm-project#27811) Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com> Signed-off-by: Tyler Michael Smith <tysmith@redhat.com> Co-authored-by: Nick Hill <nhill@redhat.com>
…vllm-project#27811) Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com> Signed-off-by: Tyler Michael Smith <tysmith@redhat.com> Co-authored-by: Nick Hill <nhill@redhat.com>
…vllm-project#27811) Signed-off-by: Tyler Michael Smith <tlrmchlsmth@gmail.com> Signed-off-by: Tyler Michael Smith <tysmith@redhat.com> Co-authored-by: Nick Hill <nhill@redhat.com>
Fix two precommit issues to get main green