Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
OpenDAS
vllm_cscc
Commits
b8401cde
Unverified
Commit
b8401cde
authored
Mar 02, 2026
by
hallerite
Committed by
GitHub
Mar 03, 2026
Browse files
add regression test (#35834)
Signed-off-by:
hallerite
<
git@hallerite.com
>
parent
5dfc5abe
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
tests/entrypoints/openai/test_tokenization_vlm.py
tests/entrypoints/openai/test_tokenization_vlm.py
+61
-0
No files found.
tests/entrypoints/openai/test_tokenization_vlm.py
0 → 100644
View file @
b8401cde
# SPDX-License-Identifier: Apache-2.0
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
"""
Regression test: ``/tokenize`` must expand image placeholders for VLM models.
Fixed by PR #34560 ("Move InputPreprocessor into Renderer (2/2)").
Before that change, ``/tokenize`` returned ~26 tokens for a message with an
image instead of the expected 1451. Confirmed broken on 0.15.1 and 0.16.0.
"""
import
json
import
pytest
import
requests
from
...utils
import
RemoteOpenAIServer
MODEL_NAME
=
"Qwen/Qwen2.5-VL-3B-Instruct"
@
pytest
.
fixture
(
scope
=
"module"
)
def
server
():
args
=
[
"--dtype"
,
"bfloat16"
,
"--max-model-len"
,
"4096"
,
"--max-num-seqs"
,
"5"
,
"--enforce-eager"
,
"--limit-mm-per-prompt"
,
json
.
dumps
({
"image"
:
1
}),
]
with
RemoteOpenAIServer
(
MODEL_NAME
,
args
)
as
remote_server
:
yield
remote_server
def
test_tokenize_chat_expands_image_placeholders
(
server
:
RemoteOpenAIServer
,
local_asset_server
,
):
image_url
=
local_asset_server
.
url_for
(
"stop_sign.jpg"
)
messages
=
[
{
"role"
:
"user"
,
"content"
:
[
{
"type"
:
"image_url"
,
"image_url"
:
{
"url"
:
image_url
}},
{
"type"
:
"text"
,
"text"
:
"Describe this image."
},
],
}
]
response
=
requests
.
post
(
server
.
url_for
(
"tokenize"
),
json
=
{
"model"
:
MODEL_NAME
,
"messages"
:
messages
},
)
response
.
raise_for_status
()
# stop_sign.jpg (1300x876) produces 1451 tokens after expansion.
# Without expansion the count would be ~26 (text + one placeholder).
assert
response
.
json
()[
"count"
]
==
1451
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment