Skip to content

Commit 1a1a2e9

Browse files
committed
refactor(public-release): refactro backend to make it public
1 parent 18db34d commit 1a1a2e9

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

llm_perf/update_llm_perf_leaderboard.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
import pandas as pd
55
from huggingface_hub import create_repo, snapshot_download, upload_file, repo_exists
66
from optimum_benchmark import Benchmark
7-
import requests
87
import json
98

109
from llm_perf.common.hardware_config import load_hardware_configs
@@ -19,6 +18,7 @@
1918
PERF_DF = "perf-df-{backend}-{hardware}-{subset}-{machine}.csv"
2019
LLM_DF = "llm-df.csv"
2120

21+
2222
def patch_json(file):
2323
"""
2424
Patch a JSON file by adding a 'stdev_' key with the same value as 'stdev' for all occurrences,
@@ -37,7 +37,7 @@ def patch_json(file):
3737
"""
3838
with open(file, "r") as f:
3939
data = json.load(f)
40-
40+
4141
def add_stdev_(obj):
4242
if isinstance(obj, dict):
4343
new_items = []
@@ -53,10 +53,11 @@ def add_stdev_(obj):
5353
add_stdev_(item)
5454

5555
add_stdev_(data)
56-
56+
5757
with open(file, "w") as f:
5858
json.dump(data, f, indent=4)
5959

60+
6061
def gather_benchmarks(subset: str, machine: str, backend: str, hardware: str):
6162
"""
6263
Gather the benchmarks for a given machine
@@ -99,7 +100,6 @@ def gather_benchmarks(subset: str, machine: str, backend: str, hardware: str):
99100
# return response.status_code == 200
100101

101102

102-
103103
def update_perf_dfs():
104104
"""
105105
Update the performance dataframes for all machines
@@ -116,19 +116,18 @@ def update_perf_dfs():
116116
backend,
117117
hardware_config.hardware,
118118
)
119-
except Exception as e:
119+
except Exception:
120120
print("Dataset not found for:")
121121
print(f" • Backend: {backend}")
122122
print(f" • Subset: {subset}")
123123
print(f" • Machine: {hardware_config.machine}")
124124
print(f" • Hardware Type: {hardware_config.hardware}")
125125
url = f"{PERF_REPO_ID.format(subset=subset, machine=hardware_config.machine, backend=backend, hardware=hardware_config.hardware)}"
126-
126+
127127
does_exist = repo_exists(url, repo_type="dataset")
128128

129129
if does_exist:
130130
print(f"Dataset exists: {url} but could not be processed")
131-
132131

133132

134133
scrapping_script = """

0 commit comments

Comments
 (0)