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
c68e69f1
Unverified
Commit
c68e69f1
authored
Feb 28, 2026
by
flutist
Committed by
GitHub
Feb 28, 2026
Browse files
custom dataset img support base64 (#35280)
Signed-off-by:
xjx
<
493337577@qq.com
>
parent
7e08c22b
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
6 deletions
+8
-6
vllm/benchmarks/datasets.py
vllm/benchmarks/datasets.py
+8
-6
No files found.
vllm/benchmarks/datasets.py
View file @
c68e69f1
...
...
@@ -305,9 +305,11 @@ def process_image(image: Any) -> Mapping[str, Any]:
a JPEG in memory. - Encodes the JPEG data as a base64 string. - Returns
a dictionary with the image as a base64 data URL.
3. String input: - Treats the string as a URL or local file path. -
Prepends "file://" if the string doesn't start with "http://" or
"file://". - Returns a dictionary with the image URL.
3. String input: - Treats the string as a URL, local file path, or base64
encoded data. - If string starts with "data:image/", treats as base64.
- If string starts with "http://", "https://", or "file://", treats as URL.
- Otherwise treats as local file path and prepends "file://".
- Returns a dictionary with the image URL or base64 data.
Raises:
ValueError: If the input is not a supported type.
...
...
@@ -327,14 +329,14 @@ def process_image(image: Any) -> Mapping[str, Any]:
if
isinstance
(
image
,
str
):
image_url
=
(
image
if
image
.
startswith
((
"http://"
,
"https://"
,
"file://"
))
if
image
.
startswith
((
"http://"
,
"https://"
,
"file://"
,
"data:image/"
))
else
f
"file://
{
image
}
"
)
return
{
"type"
:
"image_url"
,
"image_url"
:
{
"url"
:
image_url
}}
raise
ValueError
(
f
"Invalid image input
{
image
}
. Must be a PIL.Image.Image"
"
or str
or dictionary with raw image bytes."
f
"Invalid image input
{
image
}
. Must be a PIL.Image.Image
,
"
"
str (URL, file path, or base64 data URL),
or dictionary with raw image bytes."
)
...
...
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