guidellm 0.3.1__py3-none-any.whl → 0.6.0a5__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.
Files changed (141) hide show
  1. guidellm/__init__.py +5 -2
  2. guidellm/__main__.py +524 -255
  3. guidellm/backends/__init__.py +33 -0
  4. guidellm/backends/backend.py +109 -0
  5. guidellm/backends/openai.py +340 -0
  6. guidellm/backends/response_handlers.py +428 -0
  7. guidellm/benchmark/__init__.py +69 -39
  8. guidellm/benchmark/benchmarker.py +160 -316
  9. guidellm/benchmark/entrypoints.py +560 -127
  10. guidellm/benchmark/outputs/__init__.py +24 -0
  11. guidellm/benchmark/outputs/console.py +633 -0
  12. guidellm/benchmark/outputs/csv.py +721 -0
  13. guidellm/benchmark/outputs/html.py +473 -0
  14. guidellm/benchmark/outputs/output.py +169 -0
  15. guidellm/benchmark/outputs/serialized.py +69 -0
  16. guidellm/benchmark/profiles.py +718 -0
  17. guidellm/benchmark/progress.py +553 -556
  18. guidellm/benchmark/scenarios/__init__.py +40 -0
  19. guidellm/benchmark/scenarios/chat.json +6 -0
  20. guidellm/benchmark/scenarios/rag.json +6 -0
  21. guidellm/benchmark/schemas/__init__.py +66 -0
  22. guidellm/benchmark/schemas/base.py +402 -0
  23. guidellm/benchmark/schemas/generative/__init__.py +55 -0
  24. guidellm/benchmark/schemas/generative/accumulator.py +841 -0
  25. guidellm/benchmark/schemas/generative/benchmark.py +163 -0
  26. guidellm/benchmark/schemas/generative/entrypoints.py +381 -0
  27. guidellm/benchmark/schemas/generative/metrics.py +927 -0
  28. guidellm/benchmark/schemas/generative/report.py +158 -0
  29. guidellm/data/__init__.py +34 -4
  30. guidellm/data/builders.py +541 -0
  31. guidellm/data/collators.py +16 -0
  32. guidellm/data/config.py +120 -0
  33. guidellm/data/deserializers/__init__.py +49 -0
  34. guidellm/data/deserializers/deserializer.py +141 -0
  35. guidellm/data/deserializers/file.py +223 -0
  36. guidellm/data/deserializers/huggingface.py +94 -0
  37. guidellm/data/deserializers/memory.py +194 -0
  38. guidellm/data/deserializers/synthetic.py +246 -0
  39. guidellm/data/entrypoints.py +52 -0
  40. guidellm/data/loaders.py +190 -0
  41. guidellm/data/preprocessors/__init__.py +27 -0
  42. guidellm/data/preprocessors/formatters.py +410 -0
  43. guidellm/data/preprocessors/mappers.py +196 -0
  44. guidellm/data/preprocessors/preprocessor.py +30 -0
  45. guidellm/data/processor.py +29 -0
  46. guidellm/data/schemas.py +175 -0
  47. guidellm/data/utils/__init__.py +6 -0
  48. guidellm/data/utils/dataset.py +94 -0
  49. guidellm/extras/__init__.py +4 -0
  50. guidellm/extras/audio.py +220 -0
  51. guidellm/extras/vision.py +242 -0
  52. guidellm/logger.py +2 -2
  53. guidellm/mock_server/__init__.py +8 -0
  54. guidellm/mock_server/config.py +84 -0
  55. guidellm/mock_server/handlers/__init__.py +17 -0
  56. guidellm/mock_server/handlers/chat_completions.py +280 -0
  57. guidellm/mock_server/handlers/completions.py +280 -0
  58. guidellm/mock_server/handlers/tokenizer.py +142 -0
  59. guidellm/mock_server/models.py +510 -0
  60. guidellm/mock_server/server.py +238 -0
  61. guidellm/mock_server/utils.py +302 -0
  62. guidellm/scheduler/__init__.py +69 -26
  63. guidellm/scheduler/constraints/__init__.py +49 -0
  64. guidellm/scheduler/constraints/constraint.py +325 -0
  65. guidellm/scheduler/constraints/error.py +411 -0
  66. guidellm/scheduler/constraints/factory.py +182 -0
  67. guidellm/scheduler/constraints/request.py +312 -0
  68. guidellm/scheduler/constraints/saturation.py +722 -0
  69. guidellm/scheduler/environments.py +252 -0
  70. guidellm/scheduler/scheduler.py +137 -368
  71. guidellm/scheduler/schemas.py +358 -0
  72. guidellm/scheduler/strategies.py +617 -0
  73. guidellm/scheduler/worker.py +413 -419
  74. guidellm/scheduler/worker_group.py +712 -0
  75. guidellm/schemas/__init__.py +65 -0
  76. guidellm/schemas/base.py +417 -0
  77. guidellm/schemas/info.py +188 -0
  78. guidellm/schemas/request.py +235 -0
  79. guidellm/schemas/request_stats.py +349 -0
  80. guidellm/schemas/response.py +124 -0
  81. guidellm/schemas/statistics.py +1018 -0
  82. guidellm/{config.py → settings.py} +31 -24
  83. guidellm/utils/__init__.py +71 -8
  84. guidellm/utils/auto_importer.py +98 -0
  85. guidellm/utils/cli.py +132 -5
  86. guidellm/utils/console.py +566 -0
  87. guidellm/utils/encoding.py +778 -0
  88. guidellm/utils/functions.py +159 -0
  89. guidellm/utils/hf_datasets.py +1 -2
  90. guidellm/utils/hf_transformers.py +4 -4
  91. guidellm/utils/imports.py +9 -0
  92. guidellm/utils/messaging.py +1118 -0
  93. guidellm/utils/mixins.py +115 -0
  94. guidellm/utils/random.py +3 -4
  95. guidellm/utils/registry.py +220 -0
  96. guidellm/utils/singleton.py +133 -0
  97. guidellm/utils/synchronous.py +159 -0
  98. guidellm/utils/text.py +163 -50
  99. guidellm/utils/typing.py +41 -0
  100. guidellm/version.py +2 -2
  101. guidellm-0.6.0a5.dist-info/METADATA +364 -0
  102. guidellm-0.6.0a5.dist-info/RECORD +109 -0
  103. guidellm/backend/__init__.py +0 -23
  104. guidellm/backend/backend.py +0 -259
  105. guidellm/backend/openai.py +0 -708
  106. guidellm/backend/response.py +0 -136
  107. guidellm/benchmark/aggregator.py +0 -760
  108. guidellm/benchmark/benchmark.py +0 -837
  109. guidellm/benchmark/output.py +0 -997
  110. guidellm/benchmark/profile.py +0 -409
  111. guidellm/benchmark/scenario.py +0 -104
  112. guidellm/data/prideandprejudice.txt.gz +0 -0
  113. guidellm/dataset/__init__.py +0 -22
  114. guidellm/dataset/creator.py +0 -213
  115. guidellm/dataset/entrypoints.py +0 -42
  116. guidellm/dataset/file.py +0 -92
  117. guidellm/dataset/hf_datasets.py +0 -62
  118. guidellm/dataset/in_memory.py +0 -132
  119. guidellm/dataset/synthetic.py +0 -287
  120. guidellm/objects/__init__.py +0 -18
  121. guidellm/objects/pydantic.py +0 -89
  122. guidellm/objects/statistics.py +0 -953
  123. guidellm/preprocess/__init__.py +0 -3
  124. guidellm/preprocess/dataset.py +0 -374
  125. guidellm/presentation/__init__.py +0 -28
  126. guidellm/presentation/builder.py +0 -27
  127. guidellm/presentation/data_models.py +0 -232
  128. guidellm/presentation/injector.py +0 -66
  129. guidellm/request/__init__.py +0 -18
  130. guidellm/request/loader.py +0 -284
  131. guidellm/request/request.py +0 -79
  132. guidellm/request/types.py +0 -10
  133. guidellm/scheduler/queues.py +0 -25
  134. guidellm/scheduler/result.py +0 -155
  135. guidellm/scheduler/strategy.py +0 -495
  136. guidellm-0.3.1.dist-info/METADATA +0 -329
  137. guidellm-0.3.1.dist-info/RECORD +0 -62
  138. {guidellm-0.3.1.dist-info → guidellm-0.6.0a5.dist-info}/WHEEL +0 -0
  139. {guidellm-0.3.1.dist-info → guidellm-0.6.0a5.dist-info}/entry_points.txt +0 -0
  140. {guidellm-0.3.1.dist-info → guidellm-0.6.0a5.dist-info}/licenses/LICENSE +0 -0
  141. {guidellm-0.3.1.dist-info → guidellm-0.6.0a5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,158 @@
1
+ """
2
+ Report container for multiple generative benchmark results with persistence.
3
+
4
+ Provides data structures for aggregating multiple benchmark executions into a single
5
+ report with file I/O capabilities. Supports loading and saving benchmark collections
6
+ in JSON and YAML formats, enabling result persistence, sharing, and analysis across
7
+ different execution sessions. Core functionality includes benchmark grouping with
8
+ shared configuration parameters and flexible file path resolution.
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import json
14
+ import platform
15
+ from importlib.metadata import version
16
+ from pathlib import Path
17
+ from typing import ClassVar, Literal
18
+
19
+ import yaml
20
+ from pydantic import Field
21
+
22
+ from guidellm.benchmark.schemas.generative.benchmark import GenerativeBenchmark
23
+ from guidellm.benchmark.schemas.generative.entrypoints import (
24
+ BenchmarkGenerativeTextArgs,
25
+ )
26
+ from guidellm.schemas import StandardBaseModel
27
+
28
+ __all__ = ["GenerativeBenchmarkMetadata", "GenerativeBenchmarksReport"]
29
+
30
+
31
+ class GenerativeBenchmarkMetadata(StandardBaseModel):
32
+ """
33
+ Versioning and environment metadata for generative benchmark reports.
34
+ """
35
+
36
+ # Make sure to update version when making breaking changes to report schema
37
+ version: Literal[1] = Field(
38
+ description=(
39
+ "Version of the benchmark report schema, increments "
40
+ "whenever there is a breaking change to the output format"
41
+ ),
42
+ default=1,
43
+ )
44
+ guidellm_version: str = Field(
45
+ description="Version of the guidellm package used for the benchmark",
46
+ default_factory=lambda: version("guidellm"),
47
+ )
48
+ python_version: str = Field(
49
+ description="Version of Python interpreter used during the benchmark",
50
+ default_factory=lambda: platform.python_version(),
51
+ )
52
+ platform: str = Field(
53
+ description="Operating system platform where the benchmark was executed",
54
+ default_factory=lambda: platform.platform(),
55
+ )
56
+
57
+
58
+ class GenerativeBenchmarksReport(StandardBaseModel):
59
+ """
60
+ Container for multiple benchmark results with load/save functionality.
61
+
62
+ Aggregates multiple generative benchmark executions into a single report,
63
+ providing persistence through JSON and YAML file formats. Enables result
64
+ collection, storage, and retrieval across different execution sessions with
65
+ automatic file type detection and path resolution.
66
+
67
+ :cvar DEFAULT_FILE: Default filename used when saving to or loading from a directory
68
+ """
69
+
70
+ DEFAULT_FILE: ClassVar[str] = "benchmarks.json"
71
+
72
+ metadata: GenerativeBenchmarkMetadata = Field(
73
+ description="Metadata about the benchmark report and execution environment",
74
+ default_factory=GenerativeBenchmarkMetadata,
75
+ )
76
+ args: BenchmarkGenerativeTextArgs = Field(
77
+ description="Benchmark arguments used for all benchmarks in the report"
78
+ )
79
+ benchmarks: list[GenerativeBenchmark] = Field(
80
+ description="List of completed benchmarks in the report",
81
+ default_factory=list,
82
+ )
83
+
84
+ def save_file(
85
+ self,
86
+ path: str | Path | None = None,
87
+ type_: Literal["json", "yaml"] | None = None,
88
+ ) -> Path:
89
+ """
90
+ Save report to file in JSON or YAML format.
91
+
92
+ :param path: File path or directory for saving, defaults to current directory
93
+ with DEFAULT_FILE name
94
+ :param type_: File format override ('json' or 'yaml'), auto-detected from
95
+ extension if None
96
+ :return: Resolved path to the saved file
97
+ :raises ValueError: If file type is unsupported or cannot be determined
98
+ """
99
+ file_path = GenerativeBenchmarksReport._resolve_path(
100
+ path if path is not None else Path.cwd()
101
+ )
102
+ file_path.parent.mkdir(parents=True, exist_ok=True)
103
+ file_type = type_ or file_path.suffix.lower()[1:]
104
+ model_dict = self.model_dump()
105
+
106
+ if file_type == "json":
107
+ save_str = json.dumps(model_dict)
108
+ elif file_type in ["yaml", "yml"]:
109
+ save_str = yaml.dump(model_dict)
110
+ else:
111
+ raise ValueError(f"Unsupported file type: {file_type} for {file_path}.")
112
+
113
+ with file_path.open("w") as file:
114
+ file.write(save_str)
115
+
116
+ return file_path
117
+
118
+ @classmethod
119
+ def load_file(
120
+ cls, path: str | Path, type_: Literal["json", "yaml"] | None = None
121
+ ) -> GenerativeBenchmarksReport:
122
+ """
123
+ Load report from JSON or YAML file.
124
+
125
+ :param path: File path or directory containing DEFAULT_FILE to load from
126
+ :param type_: File format override ('json' or 'yaml'), auto-detected from
127
+ extension if None
128
+ :return: Loaded report instance with benchmarks and configuration
129
+ :raises ValueError: If file type is unsupported or cannot be determined
130
+ :raises FileNotFoundError: If specified file does not exist
131
+ """
132
+ file_path = GenerativeBenchmarksReport._resolve_path(path)
133
+ file_type = type_ or file_path.suffix.lower()[1:]
134
+
135
+ with file_path.open("r") as file:
136
+ if file_type == "json":
137
+ model_dict = json.loads(file.read())
138
+ elif file_type in ["yaml", "yml"]:
139
+ model_dict = yaml.safe_load(file)
140
+ else:
141
+ raise ValueError(f"Unsupported file type: {file_type} for {file_path}.")
142
+
143
+ return GenerativeBenchmarksReport.model_validate(model_dict)
144
+
145
+ @classmethod
146
+ def _resolve_path(cls, path: str | Path) -> Path:
147
+ """
148
+ Resolve input to file path, converting directories to DEFAULT_FILE location.
149
+
150
+ :param path: String or Path to resolve, directories append DEFAULT_FILE
151
+ :return: Resolved file path
152
+ """
153
+ resolved = Path(path) if not isinstance(path, Path) else path
154
+
155
+ if resolved.is_dir():
156
+ resolved = resolved / GenerativeBenchmarksReport.DEFAULT_FILE
157
+
158
+ return resolved
guidellm/data/__init__.py CHANGED
@@ -1,4 +1,34 @@
1
- """
2
- Required for python < 3.12
3
- https://docs.python.org/3/library/importlib.resources.html#importlib.resources.files
4
- """
1
+ from .builders import ShortPromptStrategy
2
+ from .collators import GenerativeRequestCollator
3
+ from .deserializers import (
4
+ DataNotSupportedError,
5
+ DatasetDeserializer,
6
+ DatasetDeserializerFactory,
7
+ )
8
+ from .entrypoints import process_dataset
9
+ from .loaders import DataLoader, DatasetsIterator
10
+ from .preprocessors import (
11
+ DataDependentPreprocessor,
12
+ DatasetPreprocessor,
13
+ PreprocessorRegistry,
14
+ RequestFormatter,
15
+ )
16
+ from .processor import ProcessorFactory
17
+ from .schemas import GenerativeDatasetColumnType
18
+
19
+ __all__ = [
20
+ "DataDependentPreprocessor",
21
+ "DataLoader",
22
+ "DataNotSupportedError",
23
+ "DatasetDeserializer",
24
+ "DatasetDeserializerFactory",
25
+ "DatasetPreprocessor",
26
+ "DatasetsIterator",
27
+ "GenerativeDatasetColumnType",
28
+ "GenerativeRequestCollator",
29
+ "PreprocessorRegistry",
30
+ "ProcessorFactory",
31
+ "RequestFormatter",
32
+ "ShortPromptStrategy",
33
+ "process_dataset",
34
+ ]