AlexNijjar
commited on
Commit
•
aa04fbd
1
Parent(s):
0eac6a7
fix duplicate entries and sort order
Browse files
app.py
CHANGED
@@ -63,24 +63,31 @@ def refresh_leaderboard():
|
|
63 |
if not is_valid_run(run):
|
64 |
continue
|
65 |
|
|
|
66 |
for key, value in run.summary.items():
|
67 |
if key.startswith("_"):
|
68 |
continue
|
69 |
|
|
|
|
|
70 |
try:
|
71 |
uid = int(key)
|
72 |
|
73 |
-
|
74 |
-
uid=
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
|
|
81 |
except Exception:
|
82 |
continue
|
83 |
|
|
|
|
|
|
|
84 |
leaderboard: list[tuple] = [
|
85 |
(entry.rank + 1, entry.uid, entry.model, entry.score, entry.hotkey, entry.previous_day_winner)
|
86 |
for entry in sorted(entries.values(), key=lambda entry: entry.rank)
|
|
|
63 |
if not is_valid_run(run):
|
64 |
continue
|
65 |
|
66 |
+
has_data = False
|
67 |
for key, value in run.summary.items():
|
68 |
if key.startswith("_"):
|
69 |
continue
|
70 |
|
71 |
+
has_data = True
|
72 |
+
|
73 |
try:
|
74 |
uid = int(key)
|
75 |
|
76 |
+
if uid not in entries:
|
77 |
+
entries[uid] = LeaderboardEntry(
|
78 |
+
uid=uid,
|
79 |
+
rank=value["rank"],
|
80 |
+
model=value["model"],
|
81 |
+
score=value["score"],
|
82 |
+
hotkey=value["hotkey"],
|
83 |
+
previous_day_winner=value["multiday_winner"],
|
84 |
+
)
|
85 |
except Exception:
|
86 |
continue
|
87 |
|
88 |
+
if has_data:
|
89 |
+
break
|
90 |
+
|
91 |
leaderboard: list[tuple] = [
|
92 |
(entry.rank + 1, entry.uid, entry.model, entry.score, entry.hotkey, entry.previous_day_winner)
|
93 |
for entry in sorted(entries.values(), key=lambda entry: entry.rank)
|