Skip to content

Commit 086d2b5

Browse files
committed
Address feedback + simplify
Signed-off-by: Samuel Monson <[email protected]>
1 parent 1ea30d4 commit 086d2b5

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

src/guidellm/benchmark/benchmark.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,9 @@ def from_stats(
817817
],
818818
iter_counts=[req.output_tokens for req in total_with_output_first],
819819
first_iter_counts=[
820-
req.prompt_tokens + 1 for req in total_with_output_first
820+
# prompt tokens + first token
821+
req.prompt_tokens + 1
822+
for req in total_with_output_first
821823
],
822824
),
823825
),

src/guidellm/objects/statistics.py

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ def from_values(
219219
)
220220

221221
@staticmethod
222-
def from_request_times( # noqa: C901
222+
def from_request_times(
223223
requests: list[tuple[float, float]],
224224
distribution_type: Literal["concurrency", "rate"],
225225
include_cdf: bool = False,
@@ -243,12 +243,9 @@ def from_request_times( # noqa: C901
243243
"""
244244
if distribution_type == "concurrency":
245245
# convert to delta changes based on when requests were running
246-
time_deltas: dict[float, int] = defaultdict(int)
247-
for start, end in requests:
248-
time_deltas[start] += 1
249-
time_deltas[end] -= 1
250-
251-
events = list(time_deltas.items())
246+
events = [(start, 1) for start, _ in requests] + [
247+
(end, -1) for _, end in requests
248+
]
252249
elif distribution_type == "rate":
253250
# convert to events for when requests finished
254251
global_start = min(start for start, _ in requests) if requests else 0

0 commit comments

Comments
 (0)