-
-
Notifications
You must be signed in to change notification settings - Fork 5.2k
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
[VLM] Move supported limits and max tokens to merged multi-modal processor #11669
Merged
DarkLight1337
merged 8 commits into
vllm-project:main
from
DarkLight1337:mm-processor-dummy-data
Jan 1, 2025
Merged
Changes from 3 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
b89ad4b
Move supported limits and max tokens per item to merged multi-modal p…
DarkLight1337 217fda6
Remove redundant code
DarkLight1337 c0a38c9
lint
DarkLight1337 a055a39
fix mm_processor tests
Isotr0py cf1179e
Fix missing limits
DarkLight1337 c54ccb5
Improve debugging
DarkLight1337 e1dc3f5
Fix qwen2-audio test
DarkLight1337 6b80d99
Fix qwen2-audio
DarkLight1337 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 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 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 |
---|---|---|
|
@@ -3,7 +3,7 @@ | |
import pytest | ||
from transformers import AutoTokenizer | ||
|
||
from vllm.inputs import InputContext, InputProcessingContext | ||
from vllm.inputs import InputProcessingContext | ||
|
||
from .....conftest import _ImageAssets | ||
from ....utils import build_model_context | ||
|
@@ -22,39 +22,6 @@ def processor_for_qwen2_vl(): | |
return Qwen2VLMultiModalProcessor | ||
|
||
|
||
@pytest.fixture() | ||
def get_max_qwen2_vl_image_tokens(): | ||
from vllm.model_executor.models.qwen2_vl import ( | ||
get_max_qwen2_vl_image_tokens) | ||
return get_max_qwen2_vl_image_tokens | ||
|
||
|
||
@pytest.mark.parametrize("mm_processor_kwargs,expected_max_tokens", [ | ||
({}, 16384), | ||
({ | ||
MIN_PIXELS: 64**2, | ||
MAX_PIXELS: 512**2 | ||
}, 324), | ||
]) | ||
@pytest.mark.parametrize("model", [MODEL]) | ||
def test_qwen2_vl_max_image_tokens( | ||
get_max_qwen2_vl_image_tokens, | ||
model: str, | ||
mm_processor_kwargs: Dict[str, Any], | ||
expected_max_tokens: int, | ||
): | ||
"""Ensure that the max token calc handles min/max pixels properly.""" | ||
ctx = build_model_context( | ||
model_name=model, | ||
tokenizer_name=model, | ||
mm_processor_kwargs=None, | ||
) | ||
|
||
actual_max_tokens = get_max_qwen2_vl_image_tokens( | ||
InputContext(ctx.model_config), **mm_processor_kwargs) | ||
assert actual_max_tokens == expected_max_tokens | ||
|
||
|
||
Comment on lines
-25
to
-57
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ditto |
||
@pytest.mark.parametrize( | ||
"mm_processor_kwargs, expected_toks_per_img, expected_pixels_shape", [ | ||
({}, 1426, (5704, 1176)), | ||
|
This file contains 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 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 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.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is unnecessary because we already check its consistency against the dummy data in multi-modal processor at profiling stage.