@@ -19,7 +19,7 @@ import {
19
19
} from "components/metrics/panels/TimeSeriesPanel" ;
20
20
import dayjs from "dayjs" ;
21
21
import { computeSpeedup } from "lib/benchmark/aoUtils" ;
22
- import { useBenchmark } from "lib/benchmark/llmUtils" ;
22
+ import { computeGeomean , useBenchmark } from "lib/benchmark/llmUtils" ;
23
23
import { BranchAndCommit } from "lib/types" ;
24
24
25
25
const GRAPH_ROW_HEIGHT = 245 ;
@@ -64,10 +64,6 @@ export function GraphPanel({
64
64
) ;
65
65
}
66
66
67
- if ( modelName === DEFAULT_MODEL_NAME ) {
68
- return < > </ > ;
69
- }
70
-
71
67
const dataWithSpeedup = computeSpeedup ( repoName , data ) ;
72
68
73
69
// Clamp to the nearest granularity (e.g. nearest hour) so that the times will
@@ -84,39 +80,67 @@ export function GraphPanel({
84
80
const chartData : { [ k : string ] : any } = { } ;
85
81
const graphSeries : { [ k : string ] : any } = { } ;
86
82
metricNames . forEach ( ( metric : string ) => {
87
- chartData [ metric ] = dataWithSpeedup
88
- . filter ( ( record : LLMsBenchmarkData ) => {
89
- return (
90
- record . model === modelName &&
91
- ( record . dtype === dtypeName || dtypeName === DEFAULT_DTYPE_NAME ) &&
92
- ( `${ record . device } (${ record . arch } )` === deviceName ||
93
- deviceName === DEFAULT_DEVICE_NAME ) &&
94
- record . metric === metric
95
- ) ;
96
- } )
97
- . filter ( ( record : LLMsBenchmarkData ) => {
98
- const id = record . workflow_id ;
99
- return (
100
- ( id >= lWorkflowId && id <= rWorkflowId ) ||
101
- ( id <= lWorkflowId && id >= rWorkflowId ) ||
102
- ( lWorkflowId === undefined && rWorkflowId === undefined )
103
- ) ;
104
- } )
105
- . map ( ( record : LLMsBenchmarkData ) => {
106
- const model = record . model ;
107
- const dtype = record . dtype ;
108
- const device = record . device ;
83
+ // TODO (huydhn): Only display aggregated speedup metric for now
84
+ if ( modelName === DEFAULT_MODEL_NAME && metric !== "speedup" ) {
85
+ chartData [ metric ] = [ ] ;
86
+ return ;
87
+ }
88
+
89
+ const geomean = computeGeomean ( dataWithSpeedup , metric ) ;
90
+ chartData [ metric ] =
91
+ modelName === DEFAULT_MODEL_NAME
92
+ ? geomean
93
+ . filter ( ( record : LLMsBenchmarkData ) => {
94
+ const id = record . workflow_id ;
95
+ return (
96
+ ( id >= lWorkflowId && id <= rWorkflowId ) ||
97
+ ( id <= lWorkflowId && id >= rWorkflowId ) ||
98
+ ( lWorkflowId === undefined && rWorkflowId === undefined ) ||
99
+ // This is a hack to handle the mock workflow ID coming from running TorchAO benchmark locally
100
+ // In such caase, the workflow ID is actually the epoch timestamp and the value is completely
101
+ // different than the regular GitHub workflow ID
102
+ 0.5 > rWorkflowId / lWorkflowId ||
103
+ rWorkflowId / lWorkflowId > 2
104
+ ) ;
105
+ } )
106
+ . map ( ( record : LLMsBenchmarkData ) => {
107
+ record . display = `${ record . device } (${ record . arch } )` ;
108
+ return record ;
109
+ } )
110
+ : dataWithSpeedup
111
+ . filter ( ( record : LLMsBenchmarkData ) => {
112
+ return (
113
+ record . model === modelName &&
114
+ ( record . dtype === dtypeName ||
115
+ dtypeName === DEFAULT_DTYPE_NAME ) &&
116
+ ( `${ record . device } (${ record . arch } )` === deviceName ||
117
+ deviceName === DEFAULT_DEVICE_NAME ) &&
118
+ record . metric === metric
119
+ ) ;
120
+ } )
121
+ . filter ( ( record : LLMsBenchmarkData ) => {
122
+ const id = record . workflow_id ;
123
+ return (
124
+ ( id >= lWorkflowId && id <= rWorkflowId ) ||
125
+ ( id <= lWorkflowId && id >= rWorkflowId ) ||
126
+ ( lWorkflowId === undefined && rWorkflowId === undefined )
127
+ ) ;
128
+ } )
129
+ . map ( ( record : LLMsBenchmarkData ) => {
130
+ const model = record . model ;
131
+ const dtype = record . dtype ;
132
+ const device = record . device ;
109
133
110
- record . display = model . includes ( dtype )
111
- ? model . includes ( device )
112
- ? model
113
- : `${ model } (${ device } )`
114
- : model . includes ( device )
115
- ? `${ model } (${ dtype } )`
116
- : `${ model } (${ dtype } / ${ device } )` ;
134
+ record . display = model . includes ( dtype )
135
+ ? model . includes ( device )
136
+ ? model
137
+ : `${ model } (${ device } )`
138
+ : model . includes ( device )
139
+ ? `${ model } (${ dtype } )`
140
+ : `${ model } (${ dtype } / ${ device } )` ;
117
141
118
- return record ;
119
- } ) ;
142
+ return record ;
143
+ } ) ;
120
144
121
145
graphSeries [ metric ] = seriesWithInterpolatedTimes (
122
146
chartData [ metric ] ,
@@ -141,7 +165,13 @@ export function GraphPanel({
141
165
{ metricNames
142
166
. filter ( ( metric ) => chartData [ metric ] . length !== 0 )
143
167
. map ( ( metric : string ) => (
144
- < Grid item xs = { 12 } lg = { 4 } height = { GRAPH_ROW_HEIGHT } key = { metric } >
168
+ < Grid
169
+ item
170
+ xs = { 12 }
171
+ lg = { modelName === DEFAULT_MODEL_NAME ? 12 : 4 }
172
+ height = { GRAPH_ROW_HEIGHT }
173
+ key = { metric }
174
+ >
145
175
< TimeSeriesPanelWithData
146
176
data = { chartData [ metric ] }
147
177
series = { graphSeries [ metric ] }
@@ -169,54 +199,56 @@ export function GraphPanel({
169
199
) ) }
170
200
</ Grid >
171
201
</ div >
172
- < div >
173
- < table >
174
- < thead >
175
- < tr >
176
- < th > Date</ th >
177
- < th > Commit</ th >
178
- { metricNames . map ( ( metric : string ) => (
179
- < th key = { metric } >
180
- { chartData [ metric ] . length !== 0
181
- ? metric in METRIC_DISPLAY_SHORT_HEADERS
182
- ? METRIC_DISPLAY_SHORT_HEADERS [ metric ]
183
- : metric
184
- : "" }
185
- </ th >
186
- ) ) }
187
- </ tr >
188
- </ thead >
189
- < tbody >
190
- { chartData [ availableMetric ] . map ( ( entry : any , index : number ) => {
191
- let commit = WORKFLOW_ID_TO_COMMIT [ entry . workflow_id ] ;
192
- return (
193
- < tr key = { index } >
194
- < td > { entry . granularity_bucket } </ td >
195
- < td >
196
- < code >
197
- < a
198
- onClick = { ( ) => navigator . clipboard . writeText ( commit ) }
199
- className = "animate-on-click"
200
- >
201
- { commit }
202
- </ a >
203
- </ code >
204
- </ td >
205
- { metricNames
206
- . filter ( ( metric ) => chartData [ metric ] . length !== 0 )
207
- . map ( ( metric : string ) => (
208
- < td key = { `${ metric } -${ index } ` } >
209
- { chartData [ metric ] [ index ] !== undefined
210
- ? chartData [ metric ] [ index ] . actual
211
- : "" }
212
- </ td >
213
- ) ) }
214
- </ tr >
215
- ) ;
216
- } ) }
217
- </ tbody >
218
- </ table >
219
- </ div >
202
+ { modelName !== DEFAULT_MODEL_NAME && (
203
+ < div >
204
+ < table >
205
+ < thead >
206
+ < tr >
207
+ < th > Date</ th >
208
+ < th > Commit</ th >
209
+ { metricNames . map ( ( metric : string ) => (
210
+ < th key = { metric } >
211
+ { chartData [ metric ] . length !== 0
212
+ ? metric in METRIC_DISPLAY_SHORT_HEADERS
213
+ ? METRIC_DISPLAY_SHORT_HEADERS [ metric ]
214
+ : metric
215
+ : "" }
216
+ </ th >
217
+ ) ) }
218
+ </ tr >
219
+ </ thead >
220
+ < tbody >
221
+ { chartData [ availableMetric ] . map ( ( entry : any , index : number ) => {
222
+ let commit = WORKFLOW_ID_TO_COMMIT [ entry . workflow_id ] ;
223
+ return (
224
+ < tr key = { index } >
225
+ < td > { entry . granularity_bucket } </ td >
226
+ < td >
227
+ < code >
228
+ < a
229
+ onClick = { ( ) => navigator . clipboard . writeText ( commit ) }
230
+ className = "animate-on-click"
231
+ >
232
+ { commit }
233
+ </ a >
234
+ </ code >
235
+ </ td >
236
+ { metricNames
237
+ . filter ( ( metric ) => chartData [ metric ] . length !== 0 )
238
+ . map ( ( metric : string ) => (
239
+ < td key = { `${ metric } -${ index } ` } >
240
+ { chartData [ metric ] [ index ] !== undefined
241
+ ? chartData [ metric ] [ index ] . actual
242
+ : "" }
243
+ </ td >
244
+ ) ) }
245
+ </ tr >
246
+ ) ;
247
+ } ) }
248
+ </ tbody >
249
+ </ table >
250
+ </ div >
251
+ ) }
220
252
</ >
221
253
) ;
222
254
}
0 commit comments