Spaces:
Running
on
Zero
Running
on
Zero
Commit
·
5e2794d
1
Parent(s):
c9a7557
make hub download once per app load
Browse files- utils/leaderboard.py +12 -11
- utils/vote_logger.py +2 -1
utils/leaderboard.py
CHANGED
@@ -14,6 +14,17 @@ DEFAULT_ELO = 1500
|
|
14 |
LEADERBOARD_FN = './utils/leaderboard/arena_elo_leaderboard.csv'
|
15 |
REPO_ID = "aizip-dev/Arena-Metadata"
|
16 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
17 |
#csv_path = os.path.join('utils', 'arena_elo_leaderboard.csv')
|
18 |
|
19 |
leaderboard_scheduler = CommitScheduler(
|
@@ -134,19 +145,9 @@ def load_leaderboard_data():
|
|
134 |
try:
|
135 |
# Define the path to the CSV file for leaderboard
|
136 |
csv_path = LEADERBOARD_FN
|
137 |
-
hub_leaderboard_path = hf_hub_download(
|
138 |
-
repo_id=REPO_ID,
|
139 |
-
filename="arena_elo_leaderboard.csv",
|
140 |
-
repo_type="dataset",
|
141 |
-
)
|
142 |
-
df = pd.read_csv(hub_leaderboard_path)
|
143 |
-
print(f"Successfully loaded leaderboard from the Hub. {len(df)} models.")
|
144 |
-
df.to_csv(LEADERBOARD_FN, index=False)
|
145 |
-
print(f"Leaderboard copied to {LEADERBOARD_FN} for CommitScheduler.")
|
146 |
-
|
147 |
# Check if the file exists and load it
|
148 |
if os.path.exists(csv_path):
|
149 |
-
|
150 |
# Process the data into our structure
|
151 |
for _, row in df.iterrows():
|
152 |
model = row['model']
|
|
|
14 |
LEADERBOARD_FN = './utils/leaderboard/arena_elo_leaderboard.csv'
|
15 |
REPO_ID = "aizip-dev/Arena-Metadata"
|
16 |
|
17 |
+
hub_leaderboard_path = hf_hub_download(
|
18 |
+
repo_id=REPO_ID,
|
19 |
+
filename="arena_elo_leaderboard.csv",
|
20 |
+
repo_type="dataset",
|
21 |
+
)
|
22 |
+
df = pd.read_csv(hub_leaderboard_path)
|
23 |
+
print(f"Successfully loaded leaderboard from the Hub. {len(df)} models.")
|
24 |
+
df.to_csv(LEADERBOARD_FN, index=False)
|
25 |
+
print(f"Leaderboard copied to {LEADERBOARD_FN} for CommitScheduler.")
|
26 |
+
|
27 |
+
|
28 |
#csv_path = os.path.join('utils', 'arena_elo_leaderboard.csv')
|
29 |
|
30 |
leaderboard_scheduler = CommitScheduler(
|
|
|
145 |
try:
|
146 |
# Define the path to the CSV file for leaderboard
|
147 |
csv_path = LEADERBOARD_FN
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
148 |
# Check if the file exists and load it
|
149 |
if os.path.exists(csv_path):
|
150 |
+
df = pd.read_csv(LEADERBOARD_FN)
|
151 |
# Process the data into our structure
|
152 |
for _, row in df.iterrows():
|
153 |
model = row['model']
|
utils/vote_logger.py
CHANGED
@@ -19,8 +19,9 @@ hub_votes = hf_hub_download(
|
|
19 |
filename="vote_details.csv",
|
20 |
repo_type="dataset",
|
21 |
revision="main",)
|
|
|
22 |
df = pd.read_csv(hub_votes)
|
23 |
-
print(f"Successfully loaded leaderboard from the Hub. {len(df)}
|
24 |
df.to_csv(os.path.join(FOLDER_PATH, "vote_details.csv"), index=False)
|
25 |
print(f"Votes copied to {FOLDER_PATH} for CommitScheduler.")
|
26 |
|
|
|
19 |
filename="vote_details.csv",
|
20 |
repo_type="dataset",
|
21 |
revision="main",)
|
22 |
+
|
23 |
df = pd.read_csv(hub_votes)
|
24 |
+
print(f"Successfully loaded leaderboard from the Hub. {len(df)} votes.")
|
25 |
df.to_csv(os.path.join(FOLDER_PATH, "vote_details.csv"), index=False)
|
26 |
print(f"Votes copied to {FOLDER_PATH} for CommitScheduler.")
|
27 |
|