[Core] Use individual MM items in P0/P1 cache and model runner#22570
[Core] Use individual MM items in P0/P1 cache and model runner#22570vllm-bot merged 16 commits intovllm-project:mainfrom
Conversation
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
|
👋 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.
Code Review
This pull request is a significant refactoring of how multimodal inputs are handled, moving from MultiModalKwargs per request to a list of MultiModalKwargsItem. This change is aimed at improving the design for caching and processing of multimodal data. The changes are extensive, touching many files in the core engine, workers, and tests. The tests have been updated to reflect the new logic, which is a positive sign. However, I've identified a critical issue in the new MultiModalKwargsItem.__init__ method that can lead to runtime errors with empty inputs. Additionally, there's a potential data loss bug in gpu_model_runner.py when handling raw multimodal inputs with mixed modalities, which could silently drop data. These issues should be addressed to ensure the correctness of the new implementation.
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
|
|
||
| def _expect_same_shape(tensor: torch.Tensor): | ||
| return tensor.shape[:self.dim] + tensor.shape[self.dim + 1:] | ||
| dim = self.dim + (self.dim < 0) * len(batch[0].shape) |
There was a problem hiding this comment.
The extra self.dim < 0 check allows negative dim to be passed to this field
| def num_tokens(self) -> int: | ||
| return self.num_prompt_tokens + len(self.output_token_ids) | ||
|
|
||
| # Temporary back-compatibility for plugins that define model runner |
There was a problem hiding this comment.
Isotr0py
left a comment
There was a problem hiding this comment.
Overall LGTM, just leave some nits.
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
|
Added ready label just to check CI, please don't merge yet as this is pending discussion with @ywang96 @WoosukKwon |
huachenheli
left a comment
There was a problem hiding this comment.
Mark MultiModalKwargs class as deprecated?
It is still used by |
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
|
This pull request has merge conflicts that must be resolved before it can be |
Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
### What this PR does / why we need it? 1. update `CachedRequestState` as `NewRequestData` changed in vllm-project/vllm#22570 2. drop maintenance of vllm v0.10.0 in the branch main ### Does this PR introduce _any_ user-facing change? N/A ### How was this patch tested? CI passed with existing test. - vLLM version: v0.10.0 - vLLM main: vllm-project/vllm@92ff41a --------- Signed-off-by: MengqingCao <cmq0113@163.com>
…project#22570) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk> Signed-off-by: Diego-Castan <diego.castan@ibm.com>
…project#22570) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
…project#22570) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
…project#22570) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
…project#22570) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk> Signed-off-by: Xiao Yu <xiao.yu@amd.com>
…project#22570) Signed-off-by: DarkLight1337 <tlleungac@connect.ust.hk>
…project#2367) ### What this PR does / why we need it? 1. update `CachedRequestState` as `NewRequestData` changed in vllm-project/vllm#22570 2. drop maintenance of vllm v0.10.0 in the branch main ### Does this PR introduce _any_ user-facing change? N/A ### How was this patch tested? CI passed with existing test. - vLLM version: v0.10.0 - vLLM main: vllm-project/vllm@92ff41a --------- Signed-off-by: MengqingCao <cmq0113@163.com>
…project#2367) ### What this PR does / why we need it? 1. update `CachedRequestState` as `NewRequestData` changed in vllm-project/vllm#22570 2. drop maintenance of vllm v0.10.0 in the branch main ### Does this PR introduce _any_ user-facing change? N/A ### How was this patch tested? CI passed with existing test. - vLLM version: v0.10.0 - vLLM main: vllm-project/vllm@92ff41a --------- Signed-off-by: MengqingCao <cmq0113@163.com>
…project#2367) ### What this PR does / why we need it? 1. update `CachedRequestState` as `NewRequestData` changed in vllm-project/vllm#22570 2. drop maintenance of vllm v0.10.0 in the branch main ### Does this PR introduce _any_ user-facing change? N/A ### How was this patch tested? CI passed with existing test. - vLLM version: v0.10.0 - vLLM main: vllm-project/vllm@92ff41a --------- Signed-off-by: MengqingCao <cmq0113@163.com>
Essential Elements of an Effective PR Description Checklist
supported_models.mdandexamplesfor a new model.Purpose
Follow-up to #22198 and #22457, in preparation for moving processing cache from P0 to P1.
Key changes:
MultiModalKwargsItemcan now contain empty data.MultiModalKwargsItem, and returns a new list ofMultiModalKwargsItems.EngineCoreRequest,Request,NewRequestData,CachedRequestStatenow usemm_kwargs: list[MultiModalKwargsItem]instead ofmm_inputs: list[MultiModalKwargs]. (cc @wangxiyuan please update vllm/vllm-ascend accordingly after this PR)merge_and_sort_multimodal_metadata -> argsort_mm_positionsandgroup_mm_inputs_by_modality -> group_mm_kwargs_by_modalitywith new semantics to enhance code reuse.pin_memoryargument for mergingMultiModalFieldElems (unused for now, see comment insidegroup_mm_kwargs_by_modality)Test Plan
Test Result
(Optional) Documentation Update