-
-
Notifications
You must be signed in to change notification settings - Fork 11k
[Model][-/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
Open
noooop
wants to merge
19
commits into
vllm-project:main
Choose a base branch
from
noooop:all_pooling_plus_chunked_prefill2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+183
−65
Open
Changes from all commits
Commits
Show all changes
19 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 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
Some comments aren't visible on the classic Files Changed page.
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
56 changes: 56 additions & 0 deletions
56
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,56 @@ | ||
| # 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, | ||
| # If enable_prefix_caching is enabled, | ||
| # the output of all pooling will be less than n_prompt_tokens, | ||
| # we need a method to disable prefix_caching at the request level. | ||
| enable_prefix_caching=False, | ||
| ) 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
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.