guidellm 0.4.0a180__py3-none-any.whl → 0.4.0a190__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of guidellm might be problematic. Click here for more details.

guidellm/__main__.py CHANGED
@@ -33,7 +33,7 @@ from pydantic import ValidationError
33
33
  try:
34
34
  import uvloop
35
35
  except ImportError:
36
- uvloop = None # type: ignore[assignment] # Optional dependency
36
+ uvloop = None # type: ignore[assignment] # Optional dependency
37
37
 
38
38
  from guidellm.backends import BackendType
39
39
  from guidellm.benchmark import (
@@ -116,6 +116,7 @@ def benchmark():
116
116
  )
117
117
  @click.option(
118
118
  "--scenario",
119
+ "-c",
119
120
  type=cli_tools.Union(
120
121
  click.Path(
121
122
  exists=True,
@@ -392,8 +393,10 @@ def run(**kwargs):
392
393
  disable_progress = kwargs.pop("disable_progress", False)
393
394
 
394
395
  try:
396
+ # Only set CLI args that differ from click defaults
397
+ new_kwargs = cli_tools.set_if_not_default(click.get_current_context(), **kwargs)
395
398
  args = BenchmarkGenerativeTextArgs.create(
396
- scenario=kwargs.pop("scenario", None), **kwargs
399
+ scenario=new_kwargs.pop("scenario", None), **new_kwargs
397
400
  )
398
401
  except ValidationError as err:
399
402
  # Translate pydantic valdation error to click argument error
@@ -23,7 +23,17 @@ from pathlib import Path
23
23
  from typing import Any, ClassVar, Literal, TypeVar, cast
24
24
 
25
25
  import yaml
26
- from pydantic import ConfigDict, Field, computed_field, model_serializer
26
+ from pydantic import (
27
+ AliasChoices,
28
+ AliasGenerator,
29
+ ConfigDict,
30
+ Field,
31
+ ValidationError,
32
+ ValidatorFunctionWrapHandler,
33
+ computed_field,
34
+ field_validator,
35
+ model_serializer,
36
+ )
27
37
  from torch.utils.data import Sampler
28
38
  from transformers import PreTrainedTokenizerBase
29
39
 
@@ -1142,7 +1152,8 @@ class GenerativeMetrics(StandardBaseDict):
1142
1152
  )
1143
1153
  request_duration = (
1144
1154
  (request_end_time - request_start_time)
1145
- if request_end_time and request_start_time else None
1155
+ if request_end_time and request_start_time
1156
+ else None
1146
1157
  )
1147
1158
 
1148
1159
  # Always track concurrency
@@ -1669,7 +1680,7 @@ class GenerativeBenchmark(Benchmark, StandardBaseDict):
1669
1680
  estimated_state: EstimatedBenchmarkState,
1670
1681
  scheduler_state: SchedulerState,
1671
1682
  profile: Profile,
1672
- requests: Iterable,
1683
+ requests: Iterable, # noqa: ARG003
1673
1684
  backend: BackendInterface,
1674
1685
  environment: Environment,
1675
1686
  strategy: SchedulingStrategy,
@@ -1787,9 +1798,8 @@ class BenchmarkGenerativeTextArgs(StandardBaseModel):
1787
1798
  scenario_data = scenario_data["args"]
1788
1799
  constructor_kwargs.update(scenario_data)
1789
1800
 
1790
- for key, value in kwargs.items():
1791
- if value != cls.get_default(key):
1792
- constructor_kwargs[key] = value
1801
+ # Apply overrides from kwargs
1802
+ constructor_kwargs.update(kwargs)
1793
1803
 
1794
1804
  return cls.model_validate(constructor_kwargs)
1795
1805
 
@@ -1818,13 +1828,19 @@ class BenchmarkGenerativeTextArgs(StandardBaseModel):
1818
1828
  else:
1819
1829
  return factory({}) # type: ignore[call-arg] # Confirmed correct at runtime by code above
1820
1830
 
1821
-
1822
-
1823
1831
  model_config = ConfigDict(
1824
1832
  extra="ignore",
1825
1833
  use_enum_values=True,
1826
1834
  from_attributes=True,
1827
1835
  arbitrary_types_allowed=True,
1836
+ validate_by_alias=True,
1837
+ validate_by_name=True,
1838
+ alias_generator=AliasGenerator(
1839
+ # Support field names with hyphens
1840
+ validation_alias=lambda field_name: AliasChoices(
1841
+ field_name, field_name.replace("_", "-")
1842
+ ),
1843
+ ),
1828
1844
  )
1829
1845
 
1830
1846
  # Required
@@ -1838,7 +1854,7 @@ class BenchmarkGenerativeTextArgs(StandardBaseModel):
1838
1854
  profile: StrategyType | ProfileType | Profile = Field(
1839
1855
  default="sweep", description="Benchmark profile or scheduling strategy type"
1840
1856
  )
1841
- rate: float | list[float] | None = Field(
1857
+ rate: list[float] | None = Field(
1842
1858
  default=None, description="Request rate(s) for rate-based scheduling"
1843
1859
  )
1844
1860
  # Backend configuration
@@ -1871,6 +1887,12 @@ class BenchmarkGenerativeTextArgs(StandardBaseModel):
1871
1887
  data_request_formatter: DatasetPreprocessor | dict[str, str] | str = Field(
1872
1888
  default="chat_completions",
1873
1889
  description="Request formatting preprocessor or template name",
1890
+ validation_alias=AliasChoices(
1891
+ "data_request_formatter",
1892
+ "data-request-formatter",
1893
+ "request_type",
1894
+ "request-type",
1895
+ ),
1874
1896
  )
1875
1897
  data_collator: Callable | Literal["generative"] | None = Field(
1876
1898
  default="generative", description="Data collator for batch processing"
@@ -1931,6 +1953,26 @@ class BenchmarkGenerativeTextArgs(StandardBaseModel):
1931
1953
  default=None, description="Maximum global error rate (0-1) before stopping"
1932
1954
  )
1933
1955
 
1956
+ @field_validator("data", "data_args", "rate", mode="wrap")
1957
+ @classmethod
1958
+ def single_to_list(
1959
+ cls, value: Any, handler: ValidatorFunctionWrapHandler
1960
+ ) -> list[Any]:
1961
+ """
1962
+ Ensures field is always a list.
1963
+
1964
+ :param value: Input value for the 'data' field
1965
+ :return: List of data sources
1966
+ """
1967
+ try:
1968
+ return handler(value)
1969
+ except ValidationError as err:
1970
+ # If validation fails, try wrapping the value in a list
1971
+ if err.errors()[0]["type"] == "list_type":
1972
+ return handler([value])
1973
+ else:
1974
+ raise
1975
+
1934
1976
  @model_serializer
1935
1977
  def serialize_model(self):
1936
1978
  """
@@ -9,7 +9,7 @@ from typing import Any
9
9
  import yaml
10
10
  from datasets import Features, IterableDataset, Value
11
11
  from faker import Faker
12
- from pydantic import ConfigDict, Field, model_validator
12
+ from pydantic import ConfigDict, Field, ValidationError, model_validator
13
13
  from transformers import PreTrainedTokenizerBase
14
14
 
15
15
  from guidellm.data.deserializers.deserializer import (
@@ -242,6 +242,10 @@ class SyntheticTextDatasetDeserializer(DatasetDeserializer):
242
242
  if (config := self._load_config_str(data)) is not None:
243
243
  return self(config, processor_factory, random_seed, **data_kwargs)
244
244
 
245
+ # Try to parse dict-like data directly
246
+ if (config := self._load_config_dict(data)) is not None:
247
+ return self(config, processor_factory, random_seed, **data_kwargs)
248
+
245
249
  if not isinstance(data, SyntheticTextDatasetConfig):
246
250
  raise DataNotSupportedError(
247
251
  "Unsupported data for SyntheticTextDatasetDeserializer, "
@@ -266,6 +270,15 @@ class SyntheticTextDatasetDeserializer(DatasetDeserializer):
266
270
  ),
267
271
  )
268
272
 
273
+ def _load_config_dict(self, data: Any) -> SyntheticTextDatasetConfig | None:
274
+ if not isinstance(data, dict | list):
275
+ return None
276
+
277
+ try:
278
+ return SyntheticTextDatasetConfig.model_validate(data)
279
+ except ValidationError:
280
+ return None
281
+
269
282
  def _load_config_file(self, data: Any) -> SyntheticTextDatasetConfig | None:
270
283
  if (not isinstance(data, str) and not isinstance(data, Path)) or (
271
284
  not Path(data).is_file()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: guidellm
3
- Version: 0.4.0a180
3
+ Version: 0.4.0a190
4
4
  Summary: Guidance platform for deploying and managing large language models.
5
5
  Author: Red Hat
6
6
  License: Apache-2.0
@@ -1,5 +1,5 @@
1
1
  guidellm/__init__.py,sha256=1zl-PT9IZJvDfdLSMviPLzhVE3_ZXpizmc9s7UWa6kQ,1206
2
- guidellm/__main__.py,sha256=uU5K-QV7rHBARdSTwsNRAPLVoTVT5NQ6DoHx7jssZyc,20554
2
+ guidellm/__main__.py,sha256=4Z8Rl6yEM8iHyKPEbVviCVQ29EYPc-rB_ZRTqzQfKDM,20722
3
3
  guidellm/logger.py,sha256=6qGOeff8hOJF6p57Zietq6qr64N7E40CJSQSQcUFgKc,2912
4
4
  guidellm/settings.py,sha256=C4miDtWaI5lJ4NBXxfuUitt5-6_FCzZPzM1Bjie9XoA,7283
5
5
  guidellm/version.py,sha256=NIzyWA7lNdSpf2MtPJuOjvW5h6E9nGDea2G4nGFDbgY,127
@@ -13,7 +13,7 @@ guidellm/benchmark/entrypoints.py,sha256=U_0JvZYCkQ1Z-qkF8tN_JeuhuGn8mINScwi819b
13
13
  guidellm/benchmark/output.py,sha256=jHa7u6wTh_YSBdO2oDo47079KReXHZ-AKB6zgo8SMvg,27308
14
14
  guidellm/benchmark/profile.py,sha256=RvQdmVLNLU-V8U8xIXm3vH8tY7Hp_4jNPQe5dombj8g,24007
15
15
  guidellm/benchmark/progress.py,sha256=oZqZZ_vInmifBNd490ZTgcCjaGy2_slViEABSWDJgHI,25976
16
- guidellm/benchmark/schemas.py,sha256=eC6WXTXoY3-6Q4SSBLs7VtgfLSilwP9FhsHdRH-6fr4,81249
16
+ guidellm/benchmark/schemas.py,sha256=udmODXTveil6xYBRh8fH571zpSAH_0NtxnfcrrMPkzM,82458
17
17
  guidellm/benchmark/scenarios/__init__.py,sha256=SmaYf8hfByJU4LVJ7pZKNxJPYBObl7UKpoaJEmLPdTI,1276
18
18
  guidellm/benchmark/scenarios/chat.json,sha256=4H_ByPCv_9azHn6iTxCY3FfpoUtlbShDPdNyzDwHJVQ,226
19
19
  guidellm/benchmark/scenarios/rag.json,sha256=BIpifJoAtWgB3NRRYK51ZuCH4Zvh1OeBFanB7vcxS-E,231
@@ -27,7 +27,7 @@ guidellm/data/deserializers/deserializer.py,sha256=SOCtXik1fVeS7yHgNFMihkq3RmqA-
27
27
  guidellm/data/deserializers/file.py,sha256=PzFOJcPuXrUM-OK6EbDIKhzEXDPp7X4xfe_wHZxXqKw,7445
28
28
  guidellm/data/deserializers/huggingface.py,sha256=uk2WBH9WJ8csaRrw6wXQ5Xiz_pj_fN5c4jDV9pWf1F0,2954
29
29
  guidellm/data/deserializers/memory.py,sha256=F6o2JwIUgcZHdeRkT051AS76i6wWlIw-XGH09_pOqDs,6670
30
- guidellm/data/deserializers/synthetic.py,sha256=Gcx39gwW0ZvFQSplMfT4ULXfGAVp2v7YiByKmRH5C7Y,12188
30
+ guidellm/data/deserializers/synthetic.py,sha256=2WOE8pURABFyou0vy5h1HNMlA2tIOErZ9EIjS1Du2S8,12686
31
31
  guidellm/data/preprocessors/__init__.py,sha256=khp1-m5EqJ6I40qFAYVv71LncrEXzKBmRocxQG5-ZuE,757
32
32
  guidellm/data/preprocessors/formatters.py,sha256=F5BHtJZ6PdmevS9LI6e9TJPwUKnuSsZbt7qS8n2H_eM,14078
33
33
  guidellm/data/preprocessors/mappers.py,sha256=7UBdRF2cdADqPbsri_1Mv3FhsQLJtUoIe_lSBV9owEQ,6715
@@ -87,9 +87,9 @@ guidellm/utils/statistics.py,sha256=KzUYm4fVNVtDd6FRCRBnqYmFcea-9n0JKCAZyqeZLM8,
87
87
  guidellm/utils/synchronous.py,sha256=rRkWwbDf1ty607KUhDKsqV4HcdKU5o0-1s5hwdG-Hak,5209
88
88
  guidellm/utils/text.py,sha256=0K8yUEB4gzztevxzuiMXossSoHhvzcHoKqRhQYQdOrg,11644
89
89
  guidellm/utils/typing.py,sha256=jt0o7SRbDhnvrifR3l4hN8oL3uJNxl8aMnvaoABb-MU,1235
90
- guidellm-0.4.0a180.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
91
- guidellm-0.4.0a180.dist-info/METADATA,sha256=X44ON29Q32x4n9lHgTMbcaUGI5_zC1lFggGHMOAm3u8,21923
92
- guidellm-0.4.0a180.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
93
- guidellm-0.4.0a180.dist-info/entry_points.txt,sha256=DzLFEg47fF7qY1b-9laPz9jg0KSKJ1_D9TbF93kLz_E,51
94
- guidellm-0.4.0a180.dist-info/top_level.txt,sha256=EXRGjnvFtL6MeZTe0tnHRMYcEWUW3vEqoG2zO7vFOtk,9
95
- guidellm-0.4.0a180.dist-info/RECORD,,
90
+ guidellm-0.4.0a190.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
91
+ guidellm-0.4.0a190.dist-info/METADATA,sha256=KVyG3WyZFuO0XfqVlep7C30_V95uwMmCkl9fkLTA3Pk,21923
92
+ guidellm-0.4.0a190.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
93
+ guidellm-0.4.0a190.dist-info/entry_points.txt,sha256=DzLFEg47fF7qY1b-9laPz9jg0KSKJ1_D9TbF93kLz_E,51
94
+ guidellm-0.4.0a190.dist-info/top_level.txt,sha256=EXRGjnvFtL6MeZTe0tnHRMYcEWUW3vEqoG2zO7vFOtk,9
95
+ guidellm-0.4.0a190.dist-info/RECORD,,