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
3c818bdb
Unverified
Commit
3c818bdb
authored
Jan 24, 2025
by
Roger Wang
Committed by
GitHub
Jan 24, 2025
Browse files
[Misc] Use VisionArena Dataset for VLM Benchmarking (#12389)
Signed-off-by:
Roger Wang
<
ywang@roblox.com
>
parent
6dd94dbe
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
20 deletions
+12
-20
benchmarks/benchmark_serving.py
benchmarks/benchmark_serving.py
+12
-20
No files found.
benchmarks/benchmark_serving.py
View file @
3c818bdb
...
...
@@ -200,7 +200,7 @@ def sample_sonnet_requests(
return
sampled_requests
def
sample_
mmmu_pro_
vision_requests
(
def
sample_vision
_arena
_requests
(
dataset
,
num_requests
:
int
,
tokenizer
:
PreTrainedTokenizerBase
,
...
...
@@ -212,13 +212,7 @@ def sample_mmmu_pro_vision_requests(
if
len
(
sampled_requests
)
==
num_requests
:
break
# MMMU-Pro vision direct prompt
# Ref: https://github.com/MMMU-Benchmark/MMMU/blob/6ce42f4d8f70c1841c67867152648974415b5cac/mmmu-pro/prompts.yaml#L5
prompt
=
(
"Answer with the option letter from the given choices directly. "
"The last line of your response should be of the following "
"format: 'Answer: $LETTER' (without quotes) where LETTER is one of "
"options."
)
prompt
=
data
[
"turns"
][
0
][
0
][
'content'
]
prompt_token_ids
=
tokenizer
(
prompt
).
input_ids
if
fixed_output_len
is
None
:
...
...
@@ -230,10 +224,10 @@ def sample_mmmu_pro_vision_requests(
output_len
=
fixed_output_len
assert
isinstance
(
data
[
"image
"
],
data
[
"image
s"
][
0
],
Image
),
(
"Input image format must be `PIL.Image.Image`, "
f
"given
{
type
(
data
[
'image'
])
}
."
)
image
:
Image
=
data
[
"image"
]
image
:
Image
=
data
[
"image
s
"
]
[
0
]
image
=
image
.
convert
(
"RGB"
)
image_data
=
io
.
BytesIO
()
image
.
save
(
image_data
,
format
=
'JPEG'
)
...
...
@@ -252,7 +246,7 @@ def sample_mmmu_pro_vision_requests(
def
sample_hf_requests
(
dataset_path
:
str
,
dataset_subset
:
str
,
dataset_subset
:
Optional
[
str
]
,
dataset_split
:
str
,
num_requests
:
int
,
tokenizer
:
PreTrainedTokenizerBase
,
...
...
@@ -260,19 +254,17 @@ def sample_hf_requests(
fixed_output_len
:
Optional
[
int
]
=
None
,
)
->
List
[
Tuple
[
str
,
str
,
int
,
Optional
[
Dict
[
str
,
Collection
[
str
]]]]]:
# Special case for MMMU-Pro vision dataset
if
dataset_path
==
'MMMU/MMMU_Pro'
and
dataset_subset
==
'vision'
:
assert
dataset_split
==
"test"
# Special case for vision_arena dataset
if
dataset_path
==
'lmarena-ai/vision-arena-bench-v0.1'
\
and
dataset_subset
is
None
:
assert
dataset_split
==
"train"
dataset
=
load_dataset
(
dataset_path
,
name
=
dataset_subset
,
split
=
dataset_split
,
streaming
=
True
)
assert
"image"
in
dataset
.
features
,
(
"MMMU/MMMU_Pro vision dataset must have 'image' column."
)
filter_func
=
lambda
x
:
isinstance
(
x
[
"image"
],
Image
)
dataset
=
dataset
.
shuffle
(
seed
=
random_seed
).
filter
(
filter_func
)
return
sample_mmmu_pro_vision_requests
(
dataset
,
num_requests
,
tokenizer
,
fixed_output_len
)
dataset
=
dataset
.
shuffle
(
seed
=
random_seed
)
return
sample_vision_arena_requests
(
dataset
,
num_requests
,
tokenizer
,
fixed_output_len
)
dataset
=
load_dataset
(
dataset_path
,
name
=
dataset_subset
,
...
...
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