-
-
Notifications
You must be signed in to change notification settings - Fork 11.8k
[Model][6/N] Improve all pooling task | Support chunked prefill with ALL pooling #27145
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
Merged
noooop
merged 47 commits into
vllm-project:main
from
noooop:all_pooling_plus_chunked_prefill2
Dec 4, 2025
+224
−93
Merged
Changes from all commits
Commits
Show all changes
47 commits
Select commit
Hold shift + click to select a range
86c0f38
Support chunked prefill with ALL pooling
noooop 6bd49f2
fix
noooop 44c6ee1
fix
noooop 86f0868
fix
noooop 7c1d68d
Update vllm/model_executor/layers/pooler.py
noooop f903415
Update vllm/model_executor/layers/pooler.py
noooop 72df85d
Update vllm/model_executor/layers/pooler.py
noooop 6b6e7a8
fix deep copy
noooop 9aef354
fix
noooop d574b6c
+ tests
noooop 26351d7
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop 5c4b13c
fix
noooop 178ccd2
fix StepPooler
noooop 43291db
fix StepPooler
noooop bb9a4ad
+ preempted_req
noooop 08a0739
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop 29b3d1d
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop eea5f6c
update
noooop 41ff486
update
noooop 70c0965
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop e8f222e
update
noooop d78b2cf
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop fb8197b
update
noooop c985ced
conflicts
noooop 0235532
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop 2d7f0c7
update
noooop 193e049
update
noooop 0da5b30
fix
noooop da00d3c
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop dc0127c
fix Terratorch
noooop bcc66e5
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop 1351cd6
conflicts
noooop 2e1168b
+ docs
noooop bbe7113
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop cc92d0b
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop 3373b90
+ PoolingParamsInternalStates
noooop 42d2f49
+ PoolingStates
noooop e921aed
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop 011295c
fix
noooop 3ea3144
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop 3716b1e
+ CachedRequestState.pooling_states
noooop 241b60b
- Unnecessary modification
noooop 367d6eb
fix
noooop 65c7910
num_scheduled_tokens_cpu
noooop 63a4782
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop 43bf1ef
update
noooop f7f320e
Merge branch 'main' into all_pooling_plus_chunked_prefill2
noooop File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
tests/models/language/pooling/test_all_pooling_plus_chunked_prefill.py
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,53 @@ | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
| # SPDX-FileCopyrightText: Copyright contributors to the vLLM project | ||
| import pytest | ||
| import torch | ||
| from transformers import AutoModel | ||
|
|
||
| from tests.models.utils import check_embeddings_close | ||
| from vllm import TokensPrompt | ||
|
|
||
|
|
||
| @pytest.mark.parametrize( | ||
| "model", | ||
| ["Qwen/Qwen3-Embedding-0.6B"], | ||
| ) | ||
| @torch.inference_mode | ||
| def test_embed_models(hf_runner, vllm_runner, model: str): | ||
| chunk_size = 10 | ||
| n_prompt_tokens = [55, 56, 57] | ||
| token_prompts = [[1024 + i for i in range(n)] for n in n_prompt_tokens] | ||
|
|
||
| with vllm_runner( | ||
| model, | ||
| runner="pooling", | ||
| max_model_len=128, | ||
| max_num_batched_tokens=chunk_size, | ||
| enforce_eager=True, | ||
| # `enable_chunked_prefill`: Set to `False` instead of `None` in VllmRunner | ||
| enable_chunked_prefill=True, | ||
| enable_prefix_caching=True, | ||
| ) as vllm_model: | ||
| vllm_outputs = vllm_model.token_embed( | ||
| [TokensPrompt(prompt_token_ids=t) for t in token_prompts], | ||
| ) | ||
|
|
||
| with hf_runner( | ||
| model, | ||
| auto_cls=AutoModel, | ||
| ) as hf_model: | ||
| hf_outputs = [] | ||
| for token_prompt in token_prompts: | ||
| inputs = hf_model.wrap_device({"input_ids": torch.tensor([token_prompt])}) | ||
| input_ids = inputs["input_ids"] | ||
| output = hf_model.model(input_ids) | ||
| hf_outputs.append(output.last_hidden_state.cpu().float()[0]) | ||
|
|
||
| for hf_output, vllm_output in zip(hf_outputs, vllm_outputs): | ||
| check_embeddings_close( | ||
| embeddings_0_lst=hf_output, | ||
| embeddings_1_lst=vllm_output, | ||
| name_0="hf", | ||
| name_1="vllm", | ||
| tol=1e-2, | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.