3
3
from math import ceil
4
4
from typing import TYPE_CHECKING , Optional , Union
5
5
6
- from guidellm .scheduler .strategy import SchedulingStrategy
7
6
from pydantic import BaseModel , computed_field
8
7
8
+ from guidellm .scheduler .strategy import SchedulingStrategy
9
+
9
10
if TYPE_CHECKING :
10
11
from guidellm .benchmark .benchmark import GenerativeBenchmark
11
12
@@ -215,14 +216,14 @@ class BenchmarkDatum(BaseModel):
215
216
time_per_request : TabularDistributionSummary
216
217
strategy_display_str : str
217
218
218
- def strategy_display_str (strategy : SchedulingStrategy ):
219
+ @classmethod
220
+ def get_strategy_display_str (cls , strategy : SchedulingStrategy ):
219
221
strategy_type = strategy if isinstance (strategy , str ) else strategy .type_
220
- strategy_instance = strategy if isinstance (strategy , SchedulingStrategy ) else None
221
222
222
223
if strategy_type == "concurrent" :
223
- rate = f"@{ strategy_instance .streams } " if strategy_instance else "@##" # type: ignore[attr-defined]
224
+ rate = f"@{ strategy .streams } "
224
225
elif strategy_type in ("constant" , "poisson" ):
225
- rate = f"@{ strategy_instance .rate :.2f} " if strategy_instance else "@#.##" # type: ignore[attr-defined]
226
+ rate = f"@{ strategy .rate :.2f} "
226
227
else :
227
228
rate = ""
228
229
return f"{ strategy_type } { rate } "
@@ -231,7 +232,7 @@ def strategy_display_str(strategy: SchedulingStrategy):
231
232
def from_benchmark (cls , bm : "GenerativeBenchmark" ):
232
233
rps = bm .metrics .requests_per_second .successful .mean
233
234
return cls (
234
- strategy_display_str = cls .strategy_display_str (bm .args .strategy ),
235
+ strategy_display_str = cls .get_strategy_display_str (bm .args .strategy ),
235
236
requests_per_second = rps ,
236
237
tpot = TabularDistributionSummary .from_distribution_summary (
237
238
bm .metrics .inter_token_latency_ms .successful
0 commit comments