Skip to content

Commit a9f98f3

Browse files
committed
Support dashed arguments for benchmark args
Signed-off-by: Samuel Monson <[email protected]>
1 parent ba51acf commit a9f98f3

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

src/guidellm/benchmark/schemas.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@
2424

2525
import yaml
2626
from pydantic import (
27+
AliasChoices,
28+
AliasGenerator,
2729
ConfigDict,
2830
Field,
2931
ValidationError,
@@ -1832,6 +1834,14 @@ def get_default(cls: type[BenchmarkGenerativeTextArgs], field: str) -> Any:
18321834
use_enum_values=True,
18331835
from_attributes=True,
18341836
arbitrary_types_allowed=True,
1837+
validate_by_alias=True,
1838+
validate_by_name=True,
1839+
alias_generator=AliasGenerator(
1840+
# Support field names with hyphens
1841+
validation_alias=lambda field_name: AliasChoices(
1842+
field_name, field_name.replace("_", "-")
1843+
),
1844+
),
18351845
)
18361846

18371847
# Required
@@ -1878,6 +1888,7 @@ def get_default(cls: type[BenchmarkGenerativeTextArgs], field: str) -> Any:
18781888
data_request_formatter: DatasetPreprocessor | dict[str, str] | str = Field(
18791889
default="chat_completions",
18801890
description="Request formatting preprocessor or template name",
1891+
validation_alias=AliasChoices("request_type", "request-type"),
18811892
)
18821893
data_collator: Callable | Literal["generative"] | None = Field(
18831894
default="generative", description="Data collator for batch processing"

0 commit comments

Comments
 (0)