Skip to content

Commit 9f13aff

Browse files
committed
check multimodal backend prior to dataset instantiation
Signed-off-by: NickLucche <nlucches@redhat.com>
1 parent 15bddab commit 9f13aff

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

benchmarks/benchmark_dataset.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ class SampleRequest:
6464

6565
class BenchmarkDataset(ABC):
6666
DEFAULT_SEED = 0
67+
IS_MULTIMODAL = False
6768

6869
def __init__(
6970
self,
@@ -621,6 +622,7 @@ class ConversationDataset(HuggingFaceDataset):
621622
SUPPORTED_DATASET_PATHS = {
622623
'lmms-lab/LLaVA-OneVision-Data', 'Aeala/ShareGPT_Vicuna_unfiltered'
623624
}
625+
IS_MULTIMODAL = True
624626

625627
def sample(self,
626628
tokenizer: PreTrainedTokenizerBase,
@@ -685,6 +687,7 @@ class VisionArenaDataset(HuggingFaceDataset):
685687
"lmarena-ai/vision-arena-bench-v0.1":
686688
lambda x: x["turns"][0][0]["content"]
687689
}
690+
IS_MULTIMODAL = True
688691

689692
def sample(
690693
self,
@@ -846,6 +849,8 @@ class ASRDataset(HuggingFaceDataset):
846849
}
847850

848851
DEFAULT_OUTPUT_LEN = 128
852+
IS_MULTIMODAL = True
853+
849854
# TODO Whisper-specific. Abstract interface when more models are supported.
850855
TRANSCRIPTION_PREAMBLE = "<|startoftranscript|><|en|><|transcribe|>"\
851856
"<|notimestamps|>"

benchmarks/benchmark_serving.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -274,12 +274,6 @@ async def benchmark(
274274
input_requests[0].expected_output_len, \
275275
input_requests[0].multi_modal_data
276276

277-
if (test_mm_content is not None and backend not in \
278-
["openai-chat", "openai-audio"]):
279-
# multi-modal benchmark is only available on OpenAI Chat backend.
280-
raise ValueError(
281-
"Multi-modal content is only supported on 'openai-chat' and " \
282-
"'openai-audio' backend.")
283277
assert test_mm_content is None or isinstance(test_mm_content, dict)
284278
test_input = RequestFuncInput(
285279
model=model_id,
@@ -620,6 +614,13 @@ def main(args: argparse.Namespace):
620614
f" from one of following: {supported_datasets}. "
621615
"Please consider contributing if you would "
622616
"like to add support for additional dataset formats.")
617+
618+
if (dataset_class.IS_MULTIMODAL and backend not in \
619+
["openai-chat", "openai-audio"]):
620+
# multi-modal benchmark is only available on OpenAI Chat backend.
621+
raise ValueError(
622+
"Multi-modal content is only supported on 'openai-chat' and " \
623+
"'openai-audio' backend.")
623624
input_requests = dataset_class(
624625
dataset_path=args.dataset_path,
625626
dataset_subset=args.hf_subset,

0 commit comments

Comments
 (0)