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
6fd45e7b
Unverified
Commit
6fd45e7b
authored
Aug 26, 2025
by
Cyrus Leung
Committed by
GitHub
Aug 25, 2025
Browse files
[CI/Build] Use vLLM client's user agent to fetch images (#23561)
Signed-off-by:
DarkLight1337
<
tlleungac@connect.ust.hk
>
parent
56dcf4e7
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
3 additions
and
6 deletions
+3
-6
tests/entrypoints/openai/test_vision.py
tests/entrypoints/openai/test_vision.py
+2
-4
tests/entrypoints/openai/test_vision_embedding.py
tests/entrypoints/openai/test_vision_embedding.py
+1
-2
No files found.
tests/entrypoints/openai/test_vision.py
View file @
6fd45e7b
...
@@ -6,8 +6,6 @@ import json
...
@@ -6,8 +6,6 @@ import json
import
openai
import
openai
import
pytest
import
pytest
import
pytest_asyncio
import
pytest_asyncio
import
requests
from
PIL
import
Image
from
transformers
import
AutoProcessor
from
transformers
import
AutoProcessor
from
vllm.multimodal.utils
import
encode_image_base64
,
fetch_image
from
vllm.multimodal.utils
import
encode_image_base64
,
fetch_image
...
@@ -36,7 +34,7 @@ EXPECTED_MM_BEAM_SEARCH_RES = [
...
@@ -36,7 +34,7 @@ EXPECTED_MM_BEAM_SEARCH_RES = [
],
],
[
[
"The image shows a Venn diagram with three over"
,
"The image shows a Venn diagram with three over"
,
"Th
e
image shows a Venn diagram with three intersect"
,
"Th
is
image shows a Venn diagram with three intersect"
,
],
],
[
[
"This image displays a gradient of colors ranging from"
,
"This image displays a gradient of colors ranging from"
,
...
@@ -88,7 +86,7 @@ def get_hf_prompt_tokens(model_name, content, image_url):
...
@@ -88,7 +86,7 @@ def get_hf_prompt_tokens(model_name, content, image_url):
"role"
:
"user"
,
"role"
:
"user"
,
"content"
:
f
"
{
placeholder
}{
content
}
"
,
"content"
:
f
"
{
placeholder
}{
content
}
"
,
}]
}]
images
=
[
Image
.
open
(
requests
.
ge
t
(
image_url
,
stream
=
True
).
raw
)]
images
=
[
fetch_ima
ge
(
image_url
)]
prompt
=
processor
.
tokenizer
.
apply_chat_template
(
prompt
=
processor
.
tokenizer
.
apply_chat_template
(
messages
,
tokenize
=
False
,
add_generation_prompt
=
True
)
messages
,
tokenize
=
False
,
add_generation_prompt
=
True
)
...
...
tests/entrypoints/openai/test_vision_embedding.py
View file @
6fd45e7b
...
@@ -5,7 +5,6 @@ import json
...
@@ -5,7 +5,6 @@ import json
import
pytest
import
pytest
import
requests
import
requests
from
PIL
import
Image
from
transformers
import
AutoProcessor
from
transformers
import
AutoProcessor
from
vllm.entrypoints.openai.protocol
import
EmbeddingResponse
from
vllm.entrypoints.openai.protocol
import
EmbeddingResponse
...
@@ -64,7 +63,7 @@ def get_hf_prompt_tokens(model_name, content, image_url):
...
@@ -64,7 +63,7 @@ def get_hf_prompt_tokens(model_name, content, image_url):
placeholder
=
"<|image_1|> "
placeholder
=
"<|image_1|> "
prompt
=
f
"
{
placeholder
}{
content
}
"
prompt
=
f
"
{
placeholder
}{
content
}
"
images
=
[
Image
.
open
(
requests
.
ge
t
(
image_url
,
stream
=
True
).
raw
)]
images
=
[
fetch_ima
ge
(
image_url
)]
inputs
=
processor
(
prompt
,
images
,
return_tensors
=
"pt"
)
inputs
=
processor
(
prompt
,
images
,
return_tensors
=
"pt"
)
return
inputs
.
input_ids
.
shape
[
1
]
return
inputs
.
input_ids
.
shape
[
1
]
...
...
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