A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
[Benchmarks] Throw usage error when using dataset-name random and dataset-path together (#24819)
Signed-off-by: Ye (Charlotte) Qi <yeq@meta.com>
Ye (Charlotte) Qi committed
Sep 14, 2025 at 10:50 UTC
ff68035932431c1892563f823735ee350336036f
1 file changed
+22
vllm/benchmarks/datasets.py
+22
@@ -11,6 +11,7 @@ generation. Supported dataset types include:
11
- HuggingFace
12
- VisionArena
13
"""
14
+import argparse
15
import ast
16
import base64
17
import io
@@ -1019,6 +1020,25 @@ class ShareGPTDataset(BenchmarkDataset):
1020
return samples
1021
1022
1023
+class _ValidateDatasetArgs(argparse.Action):
1024
+ """Argparse action to validate dataset name and path compatibility."""
1025
+ def __call__(self, parser, namespace, values, option_string=None):
1026
+ setattr(namespace, self.dest, values)
1027
+
1028
+ # Get current values of both dataset_name and dataset_path
1029
+ dataset_name = getattr(namespace, 'dataset_name', 'random')
1030
+ dataset_path = getattr(namespace, 'dataset_path', None)
1031
+
1032
+ # Validate the combination
1033
+ if dataset_name == "random" and dataset_path is not None:
1034
+ parser.error(
1035
+ "Cannot use 'random' dataset with --dataset-path. "
1036
+ "Please specify the appropriate --dataset-name (e.g., "
1037
+ "'sharegpt', 'custom', 'sonnet') for your dataset file: "
1038
+ f"{dataset_path}"
1039
+ )
1040
+
1041
+
1042
def add_dataset_parser(parser: FlexibleArgumentParser):
1043
parser.add_argument("--seed", type=int, default=0)
1044
parser.add_argument(
@@ -1031,6 +1051,7 @@ def add_dataset_parser(parser: FlexibleArgumentParser):
1051
"--dataset-name",
1052
type=str,
1053
default="random",
1054
+ action=_ValidateDatasetArgs,
1055
choices=[
1056
"sharegpt", "burstgpt", "sonnet", "random", "random-mm", "hf",
1057
"custom", "prefix_repetition", "spec_bench"
@@ -1046,6 +1067,7 @@ def add_dataset_parser(parser: FlexibleArgumentParser):
1067
"--dataset-path",
1068
type=str,
1069
default=None,
1070
+ action=_ValidateDatasetArgs,
1071
help="Path to the sharegpt/sonnet dataset. "
1072
"Or the huggingface dataset ID if using HF dataset.",
1073
)