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.
- guidellm/__init__.py +5 -2
- guidellm/__main__.py +524 -255
- guidellm/backends/__init__.py +33 -0
- guidellm/backends/backend.py +109 -0
- guidellm/backends/openai.py +340 -0
- guidellm/backends/response_handlers.py +428 -0
- guidellm/benchmark/__init__.py +69 -39
- guidellm/benchmark/benchmarker.py +160 -316
- guidellm/benchmark/entrypoints.py +560 -127
- guidellm/benchmark/outputs/__init__.py +24 -0
- guidellm/benchmark/outputs/console.py +633 -0
- guidellm/benchmark/outputs/csv.py +721 -0
- guidellm/benchmark/outputs/html.py +473 -0
- guidellm/benchmark/outputs/output.py +169 -0
- guidellm/benchmark/outputs/serialized.py +69 -0
- guidellm/benchmark/profiles.py +718 -0
- guidellm/benchmark/progress.py +553 -556
- guidellm/benchmark/scenarios/__init__.py +40 -0
- guidellm/benchmark/scenarios/chat.json +6 -0
- guidellm/benchmark/scenarios/rag.json +6 -0
- guidellm/benchmark/schemas/__init__.py +66 -0
- guidellm/benchmark/schemas/base.py +402 -0
- guidellm/benchmark/schemas/generative/__init__.py +55 -0
- guidellm/benchmark/schemas/generative/accumulator.py +841 -0
- guidellm/benchmark/schemas/generative/benchmark.py +163 -0
- guidellm/benchmark/schemas/generative/entrypoints.py +381 -0
- guidellm/benchmark/schemas/generative/metrics.py +927 -0
- guidellm/benchmark/schemas/generative/report.py +158 -0
- guidellm/data/__init__.py +34 -4
- guidellm/data/builders.py +541 -0
- guidellm/data/collators.py +16 -0
- guidellm/data/config.py +120 -0
- guidellm/data/deserializers/__init__.py +49 -0
- guidellm/data/deserializers/deserializer.py +141 -0
- guidellm/data/deserializers/file.py +223 -0
- guidellm/data/deserializers/huggingface.py +94 -0
- guidellm/data/deserializers/memory.py +194 -0
- guidellm/data/deserializers/synthetic.py +246 -0
- guidellm/data/entrypoints.py +52 -0
- guidellm/data/loaders.py +190 -0
- guidellm/data/preprocessors/__init__.py +27 -0
- guidellm/data/preprocessors/formatters.py +410 -0
- guidellm/data/preprocessors/mappers.py +196 -0
- guidellm/data/preprocessors/preprocessor.py +30 -0
- guidellm/data/processor.py +29 -0
- guidellm/data/schemas.py +175 -0
- guidellm/data/utils/__init__.py +6 -0
- guidellm/data/utils/dataset.py +94 -0
- guidellm/extras/__init__.py +4 -0
- guidellm/extras/audio.py +220 -0
- guidellm/extras/vision.py +242 -0
- guidellm/logger.py +2 -2
- guidellm/mock_server/__init__.py +8 -0
- guidellm/mock_server/config.py +84 -0
- guidellm/mock_server/handlers/__init__.py +17 -0
- guidellm/mock_server/handlers/chat_completions.py +280 -0
- guidellm/mock_server/handlers/completions.py +280 -0
- guidellm/mock_server/handlers/tokenizer.py +142 -0
- guidellm/mock_server/models.py +510 -0
- guidellm/mock_server/server.py +238 -0
- guidellm/mock_server/utils.py +302 -0
- guidellm/scheduler/__init__.py +69 -26
- guidellm/scheduler/constraints/__init__.py +49 -0
- guidellm/scheduler/constraints/constraint.py +325 -0
- guidellm/scheduler/constraints/error.py +411 -0
- guidellm/scheduler/constraints/factory.py +182 -0
- guidellm/scheduler/constraints/request.py +312 -0
- guidellm/scheduler/constraints/saturation.py +722 -0
- guidellm/scheduler/environments.py +252 -0
- guidellm/scheduler/scheduler.py +137 -368
- guidellm/scheduler/schemas.py +358 -0
- guidellm/scheduler/strategies.py +617 -0
- guidellm/scheduler/worker.py +413 -419
- guidellm/scheduler/worker_group.py +712 -0
- guidellm/schemas/__init__.py +65 -0
- guidellm/schemas/base.py +417 -0
- guidellm/schemas/info.py +188 -0
- guidellm/schemas/request.py +235 -0
- guidellm/schemas/request_stats.py +349 -0
- guidellm/schemas/response.py +124 -0
- guidellm/schemas/statistics.py +1018 -0
- guidellm/{config.py → settings.py} +31 -24
- guidellm/utils/__init__.py +71 -8
- guidellm/utils/auto_importer.py +98 -0
- guidellm/utils/cli.py +132 -5
- guidellm/utils/console.py +566 -0
- guidellm/utils/encoding.py +778 -0
- guidellm/utils/functions.py +159 -0
- guidellm/utils/hf_datasets.py +1 -2
- guidellm/utils/hf_transformers.py +4 -4
- guidellm/utils/imports.py +9 -0
- guidellm/utils/messaging.py +1118 -0
- guidellm/utils/mixins.py +115 -0
- guidellm/utils/random.py +3 -4
- guidellm/utils/registry.py +220 -0
- guidellm/utils/singleton.py +133 -0
- guidellm/utils/synchronous.py +159 -0
- guidellm/utils/text.py +163 -50
- guidellm/utils/typing.py +41 -0
- guidellm/version.py +2 -2
- guidellm-0.6.0a5.dist-info/METADATA +364 -0
- guidellm-0.6.0a5.dist-info/RECORD +109 -0
- guidellm/backend/__init__.py +0 -23
- guidellm/backend/backend.py +0 -259
- guidellm/backend/openai.py +0 -708
- guidellm/backend/response.py +0 -136
- guidellm/benchmark/aggregator.py +0 -760
- guidellm/benchmark/benchmark.py +0 -837
- guidellm/benchmark/output.py +0 -997
- guidellm/benchmark/profile.py +0 -409
- guidellm/benchmark/scenario.py +0 -104
- guidellm/data/prideandprejudice.txt.gz +0 -0
- guidellm/dataset/__init__.py +0 -22
- guidellm/dataset/creator.py +0 -213
- guidellm/dataset/entrypoints.py +0 -42
- guidellm/dataset/file.py +0 -92
- guidellm/dataset/hf_datasets.py +0 -62
- guidellm/dataset/in_memory.py +0 -132
- guidellm/dataset/synthetic.py +0 -287
- guidellm/objects/__init__.py +0 -18
- guidellm/objects/pydantic.py +0 -89
- guidellm/objects/statistics.py +0 -953
- guidellm/preprocess/__init__.py +0 -3
- guidellm/preprocess/dataset.py +0 -374
- guidellm/presentation/__init__.py +0 -28
- guidellm/presentation/builder.py +0 -27
- guidellm/presentation/data_models.py +0 -232
- guidellm/presentation/injector.py +0 -66
- guidellm/request/__init__.py +0 -18
- guidellm/request/loader.py +0 -284
- guidellm/request/request.py +0 -79
- guidellm/request/types.py +0 -10
- guidellm/scheduler/queues.py +0 -25
- guidellm/scheduler/result.py +0 -155
- guidellm/scheduler/strategy.py +0 -495
- guidellm-0.3.1.dist-info/METADATA +0 -329
- guidellm-0.3.1.dist-info/RECORD +0 -62
- {guidellm-0.3.1.dist-info → guidellm-0.6.0a5.dist-info}/WHEEL +0 -0
- {guidellm-0.3.1.dist-info → guidellm-0.6.0a5.dist-info}/entry_points.txt +0 -0
- {guidellm-0.3.1.dist-info → guidellm-0.6.0a5.dist-info}/licenses/LICENSE +0 -0
- {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
|
-
|
|
3
|
-
|
|
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
|
+
]
|