mirror of
https://git.datalinker.icu/vllm-project/vllm.git
synced 2025-12-15 09:05:01 +08:00
[Benchmarks] Throw usage error when using dataset-name random and dataset-path together (#24819)
Signed-off-by: Ye (Charlotte) Qi <yeq@meta.com>
This commit is contained in:
parent
1177dd53e9
commit
ff68035932
@ -11,6 +11,7 @@ generation. Supported dataset types include:
|
|||||||
- HuggingFace
|
- HuggingFace
|
||||||
- VisionArena
|
- VisionArena
|
||||||
"""
|
"""
|
||||||
|
import argparse
|
||||||
import ast
|
import ast
|
||||||
import base64
|
import base64
|
||||||
import io
|
import io
|
||||||
@ -1019,6 +1020,25 @@ class ShareGPTDataset(BenchmarkDataset):
|
|||||||
return samples
|
return samples
|
||||||
|
|
||||||
|
|
||||||
|
class _ValidateDatasetArgs(argparse.Action):
|
||||||
|
"""Argparse action to validate dataset name and path compatibility."""
|
||||||
|
def __call__(self, parser, namespace, values, option_string=None):
|
||||||
|
setattr(namespace, self.dest, values)
|
||||||
|
|
||||||
|
# Get current values of both dataset_name and dataset_path
|
||||||
|
dataset_name = getattr(namespace, 'dataset_name', 'random')
|
||||||
|
dataset_path = getattr(namespace, 'dataset_path', None)
|
||||||
|
|
||||||
|
# Validate the combination
|
||||||
|
if dataset_name == "random" and dataset_path is not None:
|
||||||
|
parser.error(
|
||||||
|
"Cannot use 'random' dataset with --dataset-path. "
|
||||||
|
"Please specify the appropriate --dataset-name (e.g., "
|
||||||
|
"'sharegpt', 'custom', 'sonnet') for your dataset file: "
|
||||||
|
f"{dataset_path}"
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def add_dataset_parser(parser: FlexibleArgumentParser):
|
def add_dataset_parser(parser: FlexibleArgumentParser):
|
||||||
parser.add_argument("--seed", type=int, default=0)
|
parser.add_argument("--seed", type=int, default=0)
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
@ -1031,6 +1051,7 @@ def add_dataset_parser(parser: FlexibleArgumentParser):
|
|||||||
"--dataset-name",
|
"--dataset-name",
|
||||||
type=str,
|
type=str,
|
||||||
default="random",
|
default="random",
|
||||||
|
action=_ValidateDatasetArgs,
|
||||||
choices=[
|
choices=[
|
||||||
"sharegpt", "burstgpt", "sonnet", "random", "random-mm", "hf",
|
"sharegpt", "burstgpt", "sonnet", "random", "random-mm", "hf",
|
||||||
"custom", "prefix_repetition", "spec_bench"
|
"custom", "prefix_repetition", "spec_bench"
|
||||||
@ -1046,6 +1067,7 @@ def add_dataset_parser(parser: FlexibleArgumentParser):
|
|||||||
"--dataset-path",
|
"--dataset-path",
|
||||||
type=str,
|
type=str,
|
||||||
default=None,
|
default=None,
|
||||||
|
action=_ValidateDatasetArgs,
|
||||||
help="Path to the sharegpt/sonnet dataset. "
|
help="Path to the sharegpt/sonnet dataset. "
|
||||||
"Or the huggingface dataset ID if using HF dataset.",
|
"Or the huggingface dataset ID if using HF dataset.",
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user