Skip to content

Commit a33b55f

Browse files
committed
push up hopefully working build to test with guidellm after the preview is live in gh-pages branch
1 parent 608bc1f commit a33b55f

File tree

10 files changed

+143
-71
lines changed

10 files changed

+143
-71
lines changed

.github/workflows/development.yml

Lines changed: 32 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,11 @@ jobs:
2929
- name: Check out code
3030
uses: actions/checkout@v3
3131

32+
- name: Set up Node.js 22
33+
uses: actions/setup-node@v4
34+
with:
35+
node-version: '22'
36+
3237
- name: Install dependencies
3338
run: npm ci
3439

@@ -59,6 +64,11 @@ jobs:
5964
- name: Check out code
6065
uses: actions/checkout@v3
6166

67+
- name: Set up Node.js 22
68+
uses: actions/setup-node@v4
69+
with:
70+
node-version: '22'
71+
6272
- name: Install dependencies
6373
run: npm ci
6474

@@ -89,6 +99,11 @@ jobs:
8999
- name: Check out code
90100
uses: actions/checkout@v3
91101

102+
- name: Set up Node.js 22
103+
uses: actions/setup-node@v4
104+
with:
105+
node-version: '22'
106+
92107
- name: Install dependencies
93108
run: npm ci
94109

@@ -119,6 +134,11 @@ jobs:
119134
- name: Check out code
120135
uses: actions/checkout@v3
121136

137+
- name: Set up Node.js 22
138+
uses: actions/setup-node@v4
139+
with:
140+
node-version: '22'
141+
122142
- name: Install dependencies
123143
run: npm ci
124144

@@ -149,6 +169,11 @@ jobs:
149169
- name: Check out code
150170
uses: actions/checkout@v3
151171

172+
- name: Set up Node.js 22
173+
uses: actions/setup-node@v4
174+
with:
175+
node-version: '22'
176+
152177
- name: Install dependencies
153178
run: npm ci
154179

@@ -219,6 +244,11 @@ jobs:
219244
with:
220245
fetch-depth: 0
221246

247+
- name: Set up Node.js 22
248+
uses: actions/setup-node@v4
249+
with:
250+
node-version: '22'
251+
222252
- name: Check if UI-related files changed
223253
id: check-changes
224254
run: |
@@ -250,7 +280,8 @@ jobs:
250280
251281
# Set asset prefix and base path with PR number
252282
ASSET_PREFIX=https://neuralmagic.github.io/guidellm/ui/pr/${PR_NUMBER}
253-
USE_MOCK_DATA=true
283+
# temporarily setting to false to test if this build works with guidellm
284+
USE_MOCK_DATA=false
254285
BASE_PATH=/ui/pr/${PR_NUMBER}
255286
GIT_SHA=${{ github.sha }}
256287
export ASSET_PREFIX=${ASSET_PREFIX}

.github/workflows/main.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,11 @@ jobs:
3030
- name: Check out code
3131
uses: actions/checkout@v3
3232

33+
- name: Set up Node.js 22
34+
uses: actions/setup-node@v4
35+
with:
36+
node-version: '22'
37+
3338
- name: Install dependencies
3439
run: npm ci
3540

@@ -60,6 +65,11 @@ jobs:
6065
- name: Check out code
6166
uses: actions/checkout@v3
6267

68+
- name: Set up Node.js 22
69+
uses: actions/setup-node@v4
70+
with:
71+
node-version: '22'
72+
6373
- name: Install dependencies
6474
run: npm ci
6575

@@ -90,6 +100,11 @@ jobs:
90100
- name: Check out code
91101
uses: actions/checkout@v3
92102

103+
- name: Set up Node.js 22
104+
uses: actions/setup-node@v4
105+
with:
106+
node-version: '22'
107+
93108
- name: Install dependencies
94109
run: npm ci
95110

@@ -120,6 +135,11 @@ jobs:
120135
- name: Check out code
121136
uses: actions/checkout@v3
122137

138+
- name: Set up Node.js 22
139+
uses: actions/setup-node@v4
140+
with:
141+
node-version: '22'
142+
123143
- name: Install dependencies
124144
run: npm ci
125145

@@ -150,6 +170,11 @@ jobs:
150170
- name: Check out code
151171
uses: actions/checkout@v3
152172

173+
- name: Set up Node.js 22
174+
uses: actions/setup-node@v4
175+
with:
176+
node-version: '22'
177+
153178
- name: Install dependencies
154179
run: npm ci
155180

@@ -165,6 +190,11 @@ jobs:
165190
- name: Check out code
166191
uses: actions/checkout@v3
167192

193+
- name: Set up Node.js 22
194+
uses: actions/setup-node@v4
195+
with:
196+
node-version: '22'
197+
168198
- name: Install dependencies
169199
run: npm ci
170200

src/guidellm/objects/statistics.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@ class Percentiles(StandardBaseModel):
3737
p25: float = Field(
3838
description="The 25th percentile of the distribution.",
3939
)
40+
p50: float = Field(
41+
description="The 50th percentile of the distribution.",
42+
)
4043
p75: float = Field(
4144
description="The 75th percentile of the distribution.",
4245
)
@@ -159,6 +162,7 @@ def from_distribution_function(
159162
p05=cdf[np.argmax(cdf[:, 1] >= 0.05), 0].item(), # noqa: PLR2004
160163
p10=cdf[np.argmax(cdf[:, 1] >= 0.1), 0].item(), # noqa: PLR2004
161164
p25=cdf[np.argmax(cdf[:, 1] >= 0.25), 0].item(), # noqa: PLR2004
165+
p50=cdf[np.argmax(cdf[:, 1] >= 0.50), 0].item(), # noqa: PLR2004
162166
p75=cdf[np.argmax(cdf[:, 1] >= 0.75), 0].item(), # noqa: PLR2004
163167
p90=cdf[np.argmax(cdf[:, 1] >= 0.9), 0].item(), # noqa: PLR2004
164168
p95=cdf[np.argmax(cdf[:, 1] >= 0.95), 0].item(), # noqa: PLR2004
@@ -172,6 +176,7 @@ def from_distribution_function(
172176
p05=0,
173177
p10=0,
174178
p25=0,
179+
p50=0,
175180
p75=0,
176181
p90=0,
177182
p95=0,

src/guidellm/presentation/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from .builder import UIDataBuilder
2-
from .data_models import (Bucket, Model, Dataset, RunInfo, TokenDistribution, TokenDetails, Server, WorkloadDetails, BenchmarkDatum)
2+
from .data_models import (Bucket, Model, Dataset, RunInfo, Distribution, TokenDetails, Server, WorkloadDetails, BenchmarkDatum)
33
from .injector import (create_report, inject_data)
44

55
__all__ = [
@@ -8,7 +8,7 @@
88
"Model",
99
"Dataset",
1010
"RunInfo",
11-
"TokenDistribution",
11+
"Distribution",
1212
"TokenDetails",
1313
"Server",
1414
"WorkloadDetails",

src/guidellm/presentation/data_models.py

Lines changed: 36 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
from collections import defaultdict
22
from math import ceil
3-
from pydantic import BaseModel
3+
from pydantic import computed_field, BaseModel
44
import random
55
from typing import List, Optional, Tuple
66

77
from guidellm.benchmark.benchmark import GenerativeBenchmark
88
from guidellm.objects.statistics import DistributionSummary
99

10-
__all__ = ["Bucket", "Model", "Dataset", "RunInfo", "TokenDistribution", "TokenDetails", "Server", "WorkloadDetails", "BenchmarkDatum"]
10+
__all__ = ["Bucket", "Model", "Dataset", "RunInfo", "Distribution", "TokenDetails", "Server", "WorkloadDetails", "BenchmarkDatum"]
1111

1212
class Bucket(BaseModel):
1313
value: float
@@ -69,22 +69,22 @@ def from_benchmarks(cls, benchmarks: list[GenerativeBenchmark]):
6969
dataset=Dataset(name="N/A")
7070
)
7171

72-
class TokenDistribution(BaseModel):
72+
class Distribution(BaseModel):
7373
statistics: Optional[DistributionSummary] = None
7474
buckets: list[Bucket]
7575
bucket_width: float
7676

7777

7878
class TokenDetails(BaseModel):
7979
samples: list[str]
80-
token_distributions: TokenDistribution
80+
token_distributions: Distribution
8181

8282
class Server(BaseModel):
8383
target: str
8484

8585
class RequestOverTime(BaseModel):
8686
num_benchmarks: int
87-
requests_over_time: TokenDistribution
87+
requests_over_time: Distribution
8888

8989
class WorkloadDetails(BaseModel):
9090
prompts: TokenDetails
@@ -109,8 +109,8 @@ def from_benchmarks(cls, benchmarks: list[GenerativeBenchmark]):
109109

110110
prompt_token_stats = DistributionSummary.from_values(prompt_tokens)
111111
output_token_stats = DistributionSummary.from_values(output_tokens)
112-
prompt_token_distributions = TokenDistribution(statistics=prompt_token_stats, buckets=prompt_token_buckets, bucket_width=1)
113-
output_token_distributions = TokenDistribution(statistics=output_token_stats, buckets=output_token_buckets, bucket_width=1)
112+
prompt_token_distributions = Distribution(statistics=prompt_token_stats, buckets=prompt_token_buckets, bucket_width=1)
113+
output_token_distributions = Distribution(statistics=output_token_stats, buckets=output_token_buckets, bucket_width=1)
114114

115115
min_start_time = benchmarks[0].run_stats.start_time
116116

@@ -122,7 +122,7 @@ def from_benchmarks(cls, benchmarks: list[GenerativeBenchmark]):
122122
]
123123
number_of_buckets = len(benchmarks)
124124
request_over_time_buckets, bucket_width = Bucket.from_data(all_req_times, None, number_of_buckets)
125-
request_over_time_distribution = TokenDistribution(buckets=request_over_time_buckets, bucket_width=bucket_width)
125+
request_over_time_distribution = Distribution(buckets=request_over_time_buckets, bucket_width=bucket_width)
126126
return cls(
127127
prompts=TokenDetails(samples=sample_prompts, token_distributions=prompt_token_distributions),
128128
generations=TokenDetails(samples=sample_outputs, token_distributions=output_token_distributions),
@@ -131,19 +131,39 @@ def from_benchmarks(cls, benchmarks: list[GenerativeBenchmark]):
131131
server=Server(target=target)
132132
)
133133

134+
class TabularDistributionSummary(DistributionSummary):
135+
"""
136+
Same fields as `DistributionSummary`, but adds a ready-to-serialize/iterate
137+
`percentile_rows` helper.
138+
"""
139+
140+
@computed_field
141+
@property
142+
def percentile_rows(self) -> list[dict[str, float]]:
143+
return [
144+
{"percentile": name, "value": value}
145+
for name, value in self.percentiles.model_dump().items()
146+
]
147+
148+
@classmethod
149+
def from_distribution_summary(
150+
cls, distribution: DistributionSummary
151+
) -> "TabularDistributionSummary":
152+
return cls(**distribution.model_dump())
153+
134154
class BenchmarkDatum(BaseModel):
135155
requests_per_second: float
136-
tpot: DistributionSummary
137-
ttft: DistributionSummary
138-
throughput: DistributionSummary
139-
time_per_request: DistributionSummary
156+
tpot: TabularDistributionSummary
157+
ttft: TabularDistributionSummary
158+
throughput: TabularDistributionSummary
159+
time_per_request: TabularDistributionSummary
140160

141161
@classmethod
142162
def from_benchmark(cls, bm: GenerativeBenchmark):
143163
return cls(
144164
requests_per_second=bm.metrics.requests_per_second.successful.mean,
145-
tpot=bm.metrics.inter_token_latency_ms.successful,
146-
ttft=bm.metrics.time_to_first_token_ms.successful,
147-
throughput=bm.metrics.output_tokens_per_second.successful,
148-
time_per_request=bm.metrics.request_latency.successful,
165+
tpot=TabularDistributionSummary.from_distribution_summary(bm.metrics.inter_token_latency_ms.successful),
166+
ttft=TabularDistributionSummary.from_distribution_summary(bm.metrics.time_to_first_token_ms.successful),
167+
throughput=TabularDistributionSummary.from_distribution_summary(bm.metrics.output_tokens_per_second.successful),
168+
time_per_request=TabularDistributionSummary.from_distribution_summary(bm.metrics.request_latency.successful),
149169
)

src/ui/lib/store/slices/benchmarks/benchmarks.api.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { ThunkDispatch, UnknownAction } from '@reduxjs/toolkit';
22
import { createApi, fetchBaseQuery } from '@reduxjs/toolkit/query/react';
33

4-
import { Benchmarks, MetricData } from './benchmarks.interfaces';
4+
import { Benchmarks, Statistics } from './benchmarks.interfaces';
55
import { formatNumber } from '../../../utils/helpers';
66
import { defaultPercentile } from '../slo/slo.constants';
77
import { setSloData } from '../slo/slo.slice';
@@ -13,14 +13,14 @@ const fetchBenchmarks = () => {
1313
};
1414

1515
const getAverageValueForPercentile = (
16-
firstMetric: MetricData,
17-
lastMetric: MetricData,
16+
firstMetric: Statistics,
17+
lastMetric: Statistics,
1818
percentile: string
1919
) => {
20-
const firstPercentile = firstMetric.percentiles.find(
20+
const firstPercentile = firstMetric.percentileRows.find(
2121
(p) => p.percentile === percentile
2222
);
23-
const lastPercentile = lastMetric.percentiles.find(
23+
const lastPercentile = lastMetric.percentileRows.find(
2424
(p) => p.percentile === percentile
2525
);
2626
return ((firstPercentile?.value ?? 0) + (lastPercentile?.value ?? 0)) / 2;
Lines changed: 9 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,32 @@
11
export type Name = 'benchmarks';
22

3-
interface Statistics {
3+
export interface Statistics {
44
total: number;
55
mean: number;
66
std: number;
77
median: number;
88
min: number;
99
max: number;
10+
percentileRows: Percentile[];
11+
percentiles: Record<PercentileValues, number>;
1012
}
1113

1214
export type PercentileValues = 'p50' | 'p90' | 'p95' | 'p99';
1315

1416
interface Percentile {
15-
percentile: string;
17+
percentile: PercentileValues;
1618
value: number;
1719
}
1820

19-
interface Bucket {
20-
value: number;
21-
count: number;
22-
}
23-
24-
export interface MetricData {
25-
statistics: Statistics;
26-
percentiles: Percentile[];
27-
buckets: Bucket[];
28-
bucketWidth: number;
29-
}
30-
3121
export interface BenchmarkMetrics {
32-
ttft: MetricData;
33-
tpot: MetricData;
34-
timePerRequest: MetricData;
35-
throughput: MetricData;
22+
ttft: Statistics;
23+
tpot: Statistics;
24+
timePerRequest: Statistics;
25+
throughput: Statistics;
3626
}
3727

3828
export interface Benchmark extends BenchmarkMetrics {
3929
requestsPerSecond: number;
4030
}
4131

42-
export type Benchmarks = {
43-
benchmarks: Benchmark[];
44-
};
32+
export type Benchmarks = Benchmark[];

0 commit comments

Comments
 (0)