Datasets:

Modalities:
Tabular
Text
Formats:
parquet
Size:
< 1K
ArXiv:
Libraries:
Datasets
pandas
License:
Grigori Fursin commited on
Commit
b66a703
·
unverified ·
1 Parent(s): 8e58ecd

first commit

Browse files
Files changed (6) hide show
  1. README.md +49 -0
  2. data.json +0 -0
  3. data.parquet +3 -0
  4. processor.py +624 -0
  5. requirements.txt +3 -0
  6. semi-raw-mlperf-data.tar.bz2 +3 -0
README.md CHANGED
@@ -1,3 +1,52 @@
1
  ---
2
  license: apache-2.0
3
  ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  ---
2
  license: apache-2.0
3
  ---
4
+
5
+ # Preparing OpenMLPerf dataset
6
+
7
+ To process the semi-raw MLPerf data into the OpenMLPerf dataset, run the following command:
8
+
9
+ ```bash
10
+ # Go to the OpenMLPerf-dataset directory
11
+ cd OpenMLPerf-dataset
12
+
13
+ # Create a virtual environment
14
+ python -m venv .venv
15
+
16
+ # Activate the virtual environment
17
+ source .venv/bin/activate
18
+
19
+ # Install the required packages
20
+ pip install -r requirements.txt
21
+
22
+ # Run the processing script
23
+ python process.py
24
+ ```
25
+
26
+ The processed dataset will be saved both as `data.json` and `data.parquet` in the `OpenMLPerf-dataset` directory.
27
+ The `data.json` file is a JSON file containing the processed data, while the `data.parquet` file is a Parquet file containing the same data in a more efficient format for storage and processing.
28
+
29
+ # Preprocessing raw MLPerf results using MLCommons CMX
30
+
31
+ We preprocess official raw MLPerf data, such as [inference v5.0](https://github.com/mlcommons/inference_results_v5.0),
32
+ into semi-raw format compatible with the `process.py` script, using the [MLCommons CM/CMX automation framework](https://arxiv.org/abs/2406.16791).
33
+ This is done using through the ["import mlperf results"](https://github.com/mlcommons/ck/tree/master/cmx4mlops/repo/flex.task/import-mlperf-results)
34
+ automation action, which we plan to document in more detail soon.
35
+
36
+ # License and Copyright
37
+
38
+ This project is licensed under the [Apache License 2.0](LICENSE.md).
39
+
40
+ © 2025 FlexAI
41
+
42
+ Portions of the data were adapted from the following MLCommons repositories,
43
+ which are also licensed under the Apache 2.0 license:
44
+
45
+ * [mlcommons@inference_results_v5.0](https://github.com/mlcommons/inference_results_v5.0)
46
+ * [mlcommons@inference_results_v4.1](https://github.com/mlcommons/inference_results_v4.1)
47
+ * [mlcommons@inference_results_v4.0](https://github.com/mlcommons/inference_results_v4.0)
48
+ * [mlcommons@inference_results_v3.1](https://github.com/mlcommons/inference_results_v3.1)
49
+
50
+ # Authors and maintaners
51
+
52
+ [Daniel Altunay](https://www.linkedin.com/in/daltunay) and [Grigori Fursin](https://cKnowledge.org/gfursin) (FCS Labs)
data.json ADDED
The diff for this file is too large to render. See raw diff
 
data.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:845063b17e66072eb21e17c650f7745b49da8f12eb2e591827c823c041121588
3
+ size 44318
processor.py ADDED
@@ -0,0 +1,624 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Data processing module for MLPerf benchmark data."""
2
+
3
+ import glob
4
+ import json
5
+ import logging
6
+ import os
7
+ import re
8
+ from collections import defaultdict
9
+
10
+ import polars as pl
11
+ from datasets import Dataset
12
+
13
+ logger = logging.getLogger(__name__)
14
+
15
+ FEATURES = {
16
+ "Performance": {
17
+ "metrics.result": "continuous",
18
+ "metrics.result_per_accelerator": "continuous",
19
+ "metrics.accuracy": "continuous",
20
+ },
21
+ "Model": {
22
+ "model.name": "categorical",
23
+ "model.mlperf_name": "categorical",
24
+ "model.architecture": "categorical",
25
+ "model.number_of_parameters": "continuous",
26
+ "model.weight_data_types": "categorical",
27
+ },
28
+ "Accelerator": {
29
+ "system.accelerator.vendor": "categorical",
30
+ "system.accelerator.name": "categorical",
31
+ "system.accelerator.count_per_node": "continuous",
32
+ "system.accelerator.total_count": "continuous",
33
+ "system.accelerator.memory_capacity": "continuous",
34
+ "system.accelerator.memory_config": "text",
35
+ "system.interconnect.accelerator": "categorical",
36
+ },
37
+ "CPU": {
38
+ "system.cpu.vendor": "categorical",
39
+ "system.cpu.model": "categorical",
40
+ "system.cpu.core_count": "continuous",
41
+ "system.cpu.count_per_node": "continuous",
42
+ "system.cpu.frequency": "continuous",
43
+ "system.cpu.caches": "text",
44
+ "system.cpu.vcpu_count": "continuous",
45
+ },
46
+ "System": {
47
+ "system.name": "text",
48
+ "system.type": "categorical",
49
+ "system.cooling": "categorical",
50
+ "system.number_of_nodes": "continuous",
51
+ "system.memory.capacity": "continuous",
52
+ "system.memory.configuration": "text",
53
+ "system.interconnect.accelerator_host": "categorical",
54
+ },
55
+ "Software": {
56
+ "software.framework": "categorical",
57
+ "software.version": "categorical",
58
+ "software.operating_system": "categorical",
59
+ },
60
+ "Submission": {
61
+ "submission.organization": "categorical",
62
+ "submission.division": "categorical",
63
+ "submission.scenario": "categorical",
64
+ "submission.availability": "boolean",
65
+ },
66
+ }
67
+
68
+ MISSING_VALUES = defaultdict(set)
69
+
70
+
71
+ def get_feature_type(feature_name: str) -> str:
72
+ """Get the type of a feature from the FEATURES dictionary."""
73
+ for group in FEATURES.values():
74
+ if feature_name in group:
75
+ return group[feature_name]
76
+ return "categorical"
77
+
78
+
79
+ def find_result_files(base_path: str = "semi-raw-mlperf-data") -> list[str]:
80
+ """Find all cmx-result-summary.json files."""
81
+ return glob.glob(
82
+ os.path.join(base_path, "**/cmx-result-summary.json"), recursive=True
83
+ )
84
+
85
+
86
+ def load_raw_data(base_path: str = "semi-raw-mlperf-data") -> pl.DataFrame:
87
+ """Load and merge data from MLPerf result files."""
88
+ result_files = find_result_files(base_path)
89
+ logger.info(f"Found {len(result_files)} result files")
90
+ all_records = []
91
+
92
+ for file_path in result_files:
93
+ with open(file_path, "r") as f:
94
+ all_records.extend(json.loads(f.read()))
95
+
96
+ df = pl.DataFrame(all_records, infer_schema_length=None)
97
+ logger.info(f"Loaded {len(df)} raw benchmark records")
98
+
99
+ rename_map = {
100
+ "Accuracy": "metrics.accuracy",
101
+ "Availability": "submission.availability",
102
+ "Organization": "submission.organization",
103
+ "Division": "submission.division",
104
+ "Scenario": "submission.scenario",
105
+ "Result": "metrics.result",
106
+ "Units": "metrics.units",
107
+ "MlperfModel": "model.mlperf_name",
108
+ "Model": "model.name",
109
+ "weight_data_types": "model.weight_data_types",
110
+ "framework": "software.framework",
111
+ "operating_system": "software.operating_system",
112
+ "SystemName": "system.name",
113
+ "system.system_name": "system.name",
114
+ "SystemType": "system.type",
115
+ "system.system_type": "system.type",
116
+ "accelerator_model_name": "system.accelerator.name",
117
+ "system.accelerator_model_name": "system.accelerator.name",
118
+ "number_of_nodes": "system.number_of_nodes",
119
+ "accelerators_per_node": "system.accelerator.count_per_node",
120
+ "system.accelerators_per_node": "system.accelerator.count_per_node",
121
+ "host_processor_core_count": "system.cpu.core_count",
122
+ "system.host_processor_core_count": "system.cpu.core_count",
123
+ "host_processor_model_name": "system.cpu.model",
124
+ "system.host_processor_model_name": "system.cpu.model",
125
+ "host_processors_per_node": "system.cpu.count_per_node",
126
+ "system.host_processors_per_node": "system.cpu.count_per_node",
127
+ "cooling": "system.cooling",
128
+ "system.cooling": "system.cooling",
129
+ "system.accelerator_host_interconnect": "system.interconnect.accelerator_host",
130
+ "system.accelerator_interconnect": "system.interconnect.accelerator",
131
+ "system.accelerator_memory_capacity": "system.accelerator.memory_capacity",
132
+ "system.accelerator_memory_configuration": "system.accelerator.memory_config",
133
+ "system.host_memory_capacity": "system.memory.capacity",
134
+ "system.host_memory_configuration": "system.memory.configuration",
135
+ "system.host_processor_frequency": "system.cpu.frequency",
136
+ "system.host_processor_caches": "system.cpu.caches",
137
+ "system.host_processor_vcpu_count": "system.cpu.vcpu_count",
138
+ }
139
+
140
+ for old_name, new_name in rename_map.items():
141
+ if old_name in df.columns:
142
+ if new_name in df.columns:
143
+ df = df.drop(new_name)
144
+ df = df.rename({old_name: new_name})
145
+
146
+ columns_to_select = list(set(rename_map.values()))
147
+ return df.select([col for col in columns_to_select if col in df.columns])
148
+
149
+
150
+ def is_within_tolerance(value1: float, value2: float, tolerance: float = 0.1) -> bool:
151
+ """Check if two values are within a specified tolerance."""
152
+ if value1 is None or value2 is None:
153
+ return value1 == value2
154
+
155
+ if value1 == 0 or value2 == 0:
156
+ return value1 == value2
157
+
158
+ percentage_diff = abs(value1 - value2) / max(abs(value1), abs(value2))
159
+ return percentage_diff <= tolerance
160
+
161
+
162
+ def find_similar_configurations(
163
+ df: pl.DataFrame, query_config: dict, continuous_tolerance: float = 0.1
164
+ ) -> pl.DataFrame:
165
+ """Find configurations similar to the query_config."""
166
+ mask = pl.lit(True)
167
+
168
+ for feature, value in query_config.items():
169
+ if value is None:
170
+ continue
171
+
172
+ if get_feature_type(feature) == "continuous":
173
+ lower_bound = value * (1 - continuous_tolerance)
174
+ upper_bound = value * (1 + continuous_tolerance)
175
+ feature_mask = (pl.col(feature) >= lower_bound) & (
176
+ pl.col(feature) <= upper_bound
177
+ )
178
+ else:
179
+ feature_mask = pl.col(feature) == value
180
+
181
+ mask = mask & feature_mask
182
+
183
+ return df.filter(mask)
184
+
185
+
186
+ def convert_memory_to_gb(value: str) -> float | None:
187
+ """Convert memory string to GB."""
188
+ if value is None:
189
+ return None
190
+
191
+ if "+" in value:
192
+ left, right = value.split("+", 1)
193
+ return (convert_memory_to_gb(left) or 0.0) + (
194
+ convert_memory_to_gb(right) or 0.0
195
+ ) or None
196
+
197
+ value = value.replace(" ", "").upper()
198
+ numeric = ""
199
+ for char in value:
200
+ if char.isdigit() or char == ".":
201
+ numeric += char
202
+ else:
203
+ break
204
+
205
+ if not numeric:
206
+ return None
207
+
208
+ number = float(numeric)
209
+ if "TB" in value or "TIB" in value:
210
+ return number * 1024
211
+ elif "GB" in value or "GIB" in value:
212
+ return number
213
+ else:
214
+ return None
215
+
216
+
217
+ def convert_frequency_to_ghz(value: str) -> float | None:
218
+ """Convert frequency string to GHz."""
219
+ if not value or value == "undefined":
220
+ MISSING_VALUES["frequency_values"].add(str(value))
221
+ return None
222
+
223
+ value = value.strip().upper()
224
+ if value.isdigit():
225
+ return float(value) / 1000
226
+
227
+ matches = re.findall(r"([\d.]+)\s*(?:GHZ|MHZ)?", value, re.IGNORECASE)
228
+ if not matches:
229
+ MISSING_VALUES["frequency_values"].add(str(value))
230
+ return None
231
+
232
+ frequencies = [float(match) for match in matches]
233
+ max_freq = max(frequencies)
234
+ if "MHZ" in value.upper():
235
+ max_freq /= 1000
236
+
237
+ return max_freq
238
+
239
+
240
+ def extract_accelerator_vendor(name: str) -> str | None:
241
+ """Extract vendor from accelerator name."""
242
+ if name is None:
243
+ MISSING_VALUES["accelerator_names"].add(None)
244
+ return None
245
+
246
+ name_upper = name.upper()
247
+ known_vendors = {
248
+ "NVIDIA": ["NVIDIA", "TESLA", "A100", "H100", "T4"],
249
+ "AMD": ["AMD"],
250
+ "Intel": ["INTEL", "HABANA", "GAUDI"],
251
+ "Google": ["TPU", "TRILLIUM", "LPU", "VPU"],
252
+ "Qualcomm": ["QUALCOMM", "ADRENO", "HEXAGON", "CLOUD AI 100", "SNAPDRAGON"],
253
+ "UntetherAI": ["UNTETHERAIR", "SPEEDAI"],
254
+ "Huawei": ["DAVINCI"],
255
+ "Moffett": ["MOFFETT"],
256
+ }
257
+
258
+ for vendor, keywords in known_vendors.items():
259
+ if any(keyword in name_upper for keyword in keywords):
260
+ return vendor
261
+
262
+ MISSING_VALUES["accelerator_vendors"].add(name)
263
+ return None
264
+
265
+
266
+ def extract_cpu_vendor(name: str) -> str | None:
267
+ """Extract vendor from CPU model name."""
268
+ if name is None:
269
+ MISSING_VALUES["cpu_names"].add(None)
270
+ return None
271
+
272
+ name_upper = name.upper()
273
+ known_vendors = {
274
+ "AMD": ["AMD", "EPYC"],
275
+ "Intel": ["INTEL", "XEON"],
276
+ "NVIDIA": ["NVIDIA", "GRACE"],
277
+ "ARM": ["ARM", "CORTEX", "NEOVERSE", "ARMV8"],
278
+ "AWS": ["AWS", "GRAVITON"],
279
+ "Apple": ["APPLE", "M1", "M2", "M3"],
280
+ "Qualcomm": ["QUALCOMM", "SNAPDRAGON"],
281
+ }
282
+
283
+ for vendor, keywords in known_vendors.items():
284
+ if any(keyword in name_upper for keyword in keywords):
285
+ return vendor
286
+
287
+ MISSING_VALUES["cpu_vendors"].add(name)
288
+ return None
289
+
290
+
291
+ def extract_framework_info(framework_str: str) -> list[tuple[str, str]]:
292
+ """Extract framework name-version pairs."""
293
+ if not framework_str:
294
+ return []
295
+
296
+ results = []
297
+ for item in framework_str.split(","):
298
+ item = item.strip()
299
+ name_match = re.search(r"(\w+)\s+", item)
300
+ version_match = re.search(r"\s+([\d\.]+)", item)
301
+
302
+ if name_match and version_match:
303
+ name = name_match.group(1).lower()
304
+ version = version_match.group(1)
305
+ results.append((name, version.strip(".")))
306
+
307
+ return results
308
+
309
+
310
+ def clean_string_value(value: str) -> str | None:
311
+ """Clean empty and N/A string values."""
312
+ if value.upper() in ["", "N/A", "DUMMY"]:
313
+ return None
314
+ return value
315
+
316
+
317
+ def normalize_interconnect_type(value: str) -> str | None:
318
+ """Normalize interconnect type strings."""
319
+ if value is None or value.upper() in ["TBD", "TODO", "TODD"]:
320
+ MISSING_VALUES["interconnect_types"].add(str(value))
321
+ return None
322
+
323
+ value_upper = value.upper()
324
+ if "NVLINK" in value_upper:
325
+ if any(gen in value_upper for gen in ["5TH", "5TH-GEN"]):
326
+ return "NVLink-5"
327
+ elif any(gen in value_upper for gen in ["4TH", "4TH-GEN"]):
328
+ return "NVLink-4"
329
+ else:
330
+ return "NVLink"
331
+
332
+ if "PCIE" in value_upper:
333
+ if "GEN5" in value_upper.replace(" ", ""):
334
+ return "PCIe-5"
335
+ else:
336
+ return "PCIe"
337
+
338
+ if "INFINIBAND" in value_upper:
339
+ return "InfiniBand"
340
+ if "XGMI" in value_upper:
341
+ return "XGMI"
342
+
343
+ return value
344
+
345
+
346
+ def clean_string_values(
347
+ df: pl.DataFrame, string_columns: list[str] | None = None
348
+ ) -> pl.DataFrame:
349
+ """Clean string values in specified columns."""
350
+ if string_columns is None:
351
+ string_columns = [col for col in df.columns if df[col].dtype == pl.String]
352
+ return df.with_columns(
353
+ [
354
+ pl.col(col).map_elements(clean_string_value, return_dtype=str).alias(col)
355
+ for col in string_columns
356
+ ]
357
+ )
358
+
359
+
360
+ def filter_submissions(df: pl.DataFrame) -> pl.DataFrame:
361
+ """Keep only valid token/s submissions."""
362
+ return df.filter(
363
+ (pl.col("metrics.units") == "Tokens/s")
364
+ & (pl.col("metrics.result").is_not_null())
365
+ & (pl.col("metrics.result") != 0)
366
+ & (pl.col("metrics.result").is_finite())
367
+ & (pl.col("system.accelerator.total_count") > 0)
368
+ )
369
+
370
+
371
+ def normalize_memory_values(df: pl.DataFrame) -> pl.DataFrame:
372
+ """Convert memory values to GB."""
373
+ return df.with_columns(
374
+ [
375
+ pl.col("system.accelerator.memory_capacity")
376
+ .map_elements(convert_memory_to_gb, return_dtype=float)
377
+ .alias("system.accelerator.memory_capacity"),
378
+ pl.col("system.memory.capacity")
379
+ .map_elements(convert_memory_to_gb, return_dtype=float)
380
+ .alias("system.memory.capacity"),
381
+ ]
382
+ )
383
+
384
+
385
+ def add_vendor_columns(df: pl.DataFrame) -> pl.DataFrame:
386
+ """Add vendor columns based on model names."""
387
+ return df.with_columns(
388
+ [
389
+ pl.col("system.accelerator.name")
390
+ .map_elements(extract_accelerator_vendor, return_dtype=str)
391
+ .alias("system.accelerator.vendor"),
392
+ pl.col("system.cpu.model")
393
+ .map_elements(extract_cpu_vendor, return_dtype=str)
394
+ .alias("system.cpu.vendor"),
395
+ ]
396
+ )
397
+
398
+
399
+ def normalize_interconnect_values(df: pl.DataFrame) -> pl.DataFrame:
400
+ """Normalize interconnect values."""
401
+ return df.with_columns(
402
+ [
403
+ pl.col("system.interconnect.accelerator")
404
+ .map_elements(normalize_interconnect_type, return_dtype=str)
405
+ .alias("system.interconnect.accelerator"),
406
+ pl.col("system.interconnect.accelerator_host")
407
+ .map_elements(normalize_interconnect_type, return_dtype=str)
408
+ .alias("system.interconnect.accelerator_host"),
409
+ ]
410
+ )
411
+
412
+
413
+ def extract_framework_columns(df: pl.DataFrame) -> pl.DataFrame:
414
+ """Extract framework versions into separate columns."""
415
+ df_with_id = df.with_columns(pl.Series(name="row_id", values=range(len(df))))
416
+ framework_info = []
417
+
418
+ for idx, framework_str in enumerate(df["software.framework"]):
419
+ if framework_str is not None:
420
+ for name, version in extract_framework_info(framework_str):
421
+ framework_info.append({"row_id": idx, "name": name, "version": version})
422
+
423
+ if not framework_info:
424
+ return df
425
+
426
+ df_frameworks = pl.DataFrame(framework_info)
427
+ df_pivoted = df_frameworks.pivot(
428
+ values="version",
429
+ index="row_id",
430
+ on="name",
431
+ aggregate_function="first",
432
+ )
433
+
434
+ rename_dict = {
435
+ col: f"software.framework.{col}"
436
+ for col in df_pivoted.columns
437
+ if col != "row_id"
438
+ }
439
+ df_pivoted = df_pivoted.rename(rename_dict)
440
+
441
+ return df_with_id.join(df_pivoted, on="row_id", how="left").drop("row_id")
442
+
443
+
444
+ def cast_columns(df: pl.DataFrame) -> pl.DataFrame:
445
+ """Cast columns to proper types."""
446
+ column_types = {
447
+ "system.cpu.core_count": pl.Int64,
448
+ "system.accelerator.count_per_node": pl.Int64,
449
+ "system.cpu.count_per_node": pl.Int64,
450
+ "system.number_of_nodes": pl.Int64,
451
+ }
452
+
453
+ df = df.with_columns(
454
+ pl.col("system.cpu.frequency")
455
+ .map_elements(convert_frequency_to_ghz, return_dtype=float)
456
+ .alias("system.cpu.frequency")
457
+ )
458
+
459
+ return df.cast(column_types)
460
+
461
+
462
+ def add_model_parameters(df: pl.DataFrame) -> pl.DataFrame:
463
+ """Add number of parameters column based on model name."""
464
+ model_parameters = {
465
+ "llama2-70b": 70,
466
+ "llama-2-70b": 70,
467
+ "llama3_1-405b": 405,
468
+ "llama3_1-70b": 70,
469
+ "gptj": 6,
470
+ "mixtral-8x7b": 47,
471
+ "DeepSeek-R1-Distill-Llama-8B": 8,
472
+ "Llama-3.3-70B": 70,
473
+ "deepseek-v3": 671,
474
+ }
475
+
476
+ def extract_parameters(model_name: str) -> float | None:
477
+ if not model_name:
478
+ return None
479
+ for base_name, params in model_parameters.items():
480
+ if model_name.lower().startswith(base_name.lower()):
481
+ return float(params)
482
+ return None
483
+
484
+ return df.with_columns(
485
+ pl.col("model.name")
486
+ .map_elements(extract_parameters, return_dtype=float)
487
+ .alias("model.number_of_parameters")
488
+ )
489
+
490
+
491
+ def add_model_architecture(df: pl.DataFrame) -> pl.DataFrame:
492
+ """Add model architecture classification."""
493
+ model_architectures = {
494
+ "llama": "LLM",
495
+ "gpt": "LLM",
496
+ "mixtral": "LLM",
497
+ "deepseek": "LLM",
498
+ "falcon": "LLM",
499
+ "mistral": "LLM",
500
+ }
501
+
502
+ def classify_architecture(model_name: str) -> str | None:
503
+ if not model_name:
504
+ return None
505
+ model_name_lower = model_name.lower()
506
+ for pattern, arch in model_architectures.items():
507
+ if pattern in model_name_lower:
508
+ return arch
509
+ return "Other"
510
+
511
+ return df.with_columns(
512
+ pl.col("model.name")
513
+ .map_elements(classify_architecture, return_dtype=str)
514
+ .alias("model.architecture")
515
+ )
516
+
517
+
518
+ def add_total_accelerator_count(df: pl.DataFrame) -> pl.DataFrame:
519
+ """Compute total number of accelerators."""
520
+ return df.with_columns(
521
+ (
522
+ pl.col("system.number_of_nodes")
523
+ * pl.col("system.accelerator.count_per_node")
524
+ ).alias("system.accelerator.total_count")
525
+ )
526
+
527
+
528
+ def add_normalized_performance(df: pl.DataFrame) -> pl.DataFrame:
529
+ """Add performance per accelerator metric."""
530
+ return df.with_columns(
531
+ (pl.col("metrics.result") / pl.col("system.accelerator.total_count")).alias(
532
+ "metrics.result_per_accelerator"
533
+ )
534
+ )
535
+
536
+
537
+ def sort_columns_alphabetically(df: pl.DataFrame) -> pl.DataFrame:
538
+ """Sort columns alphabetically."""
539
+ return df.select(sorted(df.columns))
540
+
541
+
542
+ def log_missing_values() -> None:
543
+ """Log all collected missing values once."""
544
+ for category, values in MISSING_VALUES.items():
545
+ if values:
546
+ logger.warning(
547
+ f"Could not determine {len(values)} unique {category}: {sorted(str(v) for v in values)}"
548
+ )
549
+
550
+
551
+ def upload_to_huggingface_hub(
552
+ df: pl.DataFrame, dataset_name: str = "OpenMLPerf", private: bool = True
553
+ ) -> None:
554
+ """Upload the processed dataset to HuggingFace Hub."""
555
+ logger.info(f"Preparing dataset '{dataset_name}' for upload to HuggingFace Hub")
556
+ data_dict = {col: df[col].to_list() for col in df.columns}
557
+ dataset = Dataset.from_dict(data_dict)
558
+
559
+ try:
560
+ dataset.push_to_hub(dataset_name, private=private)
561
+ logger.info(
562
+ f"Successfully uploaded dataset to HuggingFace Hub as '{dataset_name}'"
563
+ )
564
+ except Exception as e:
565
+ logger.error(f"Failed to upload dataset to HuggingFace Hub: {e}")
566
+
567
+
568
+ def process_data(base_path: str = "semi-raw-mlperf-data") -> pl.DataFrame:
569
+ """Main data processing pipeline."""
570
+ logger.info("Starting data processing pipeline")
571
+
572
+ MISSING_VALUES.clear()
573
+
574
+ df = (
575
+ load_raw_data(base_path)
576
+ .pipe(clean_string_values)
577
+ .pipe(normalize_memory_values)
578
+ .pipe(cast_columns)
579
+ .pipe(add_vendor_columns)
580
+ .pipe(normalize_interconnect_values)
581
+ .pipe(extract_framework_columns)
582
+ .pipe(add_model_parameters)
583
+ .pipe(add_model_architecture)
584
+ .pipe(add_total_accelerator_count)
585
+ .pipe(add_normalized_performance)
586
+ .pipe(sort_columns_alphabetically)
587
+ .pipe(filter_submissions)
588
+ )
589
+
590
+ log_missing_values()
591
+
592
+ logger.info(f"Processed {len(df)} records")
593
+ return df
594
+
595
+
596
+ def export_data(df: pl.DataFrame) -> None:
597
+ """Export processed data to JSON file."""
598
+ with open("data.json", "w") as f:
599
+ json.dump(df.to_dicts(), f, indent=2)
600
+ logger.info("Exported data to data.json")
601
+ df.write_parquet("data.parquet")
602
+ logger.info("Exported data to data.parquet")
603
+
604
+
605
+ def main(
606
+ base_path: str = "semi-raw-mlperf-data",
607
+ upload_to_hub: bool = False,
608
+ dataset_name: str = "OpenMLPerf",
609
+ push_to_hub: bool = True,
610
+ private: bool = True,
611
+ ):
612
+ """Run the complete data processing pipeline."""
613
+ logging.basicConfig(level=logging.INFO)
614
+ df = process_data(base_path)
615
+ export_data(df)
616
+
617
+ if upload_to_hub:
618
+ upload_to_huggingface_hub(df, dataset_name, private)
619
+
620
+ return df
621
+
622
+
623
+ if __name__ == "__main__":
624
+ main(upload_to_hub=False, private=True)
requirements.txt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ datasets
2
+ polars
3
+ cmind
semi-raw-mlperf-data.tar.bz2 ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:d5538ec2e98ba482949a4daf722937a1d7790dab57bb74fbe014c9f651b9e5d8
3
+ size 1745626