Johannes Janosovits commited on
Commit
cef2bfc
·
1 Parent(s): bba2508

visibility

Browse files
Files changed (1) hide show
  1. app.py +25 -7
app.py CHANGED
@@ -59,6 +59,7 @@ _cache: dict = {"runs": None, "err": None}
59
 
60
 
61
  def _summarize(groups: dict, tasks: list) -> str:
 
62
  parts = []
63
  for g_name, g_data in groups.items():
64
  if not isinstance(g_data, dict):
@@ -70,13 +71,30 @@ def _summarize(groups: dict, tasks: list) -> str:
70
  if not mname.endswith("_stderr"):
71
  parts.append(f"{g_name}: {v:.3f}")
72
  break
73
- if not parts and tasks:
74
- first_m = next(iter(tasks[0]["metrics"]), None)
75
- if first_m:
76
- vals = [t["metrics"][first_m]["value"] for t in tasks if first_m in t["metrics"]]
77
- if vals:
78
- parts.append(f"avg {first_m}: {sum(vals)/len(vals):.3f} (n={len(tasks)})")
79
- return "; ".join(parts) or "—"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
80
 
81
 
82
  def load_runs(force: bool = False) -> tuple[list, str | None]:
 
59
 
60
 
61
  def _summarize(groups: dict, tasks: list) -> str:
62
+ # Prefer group-level aggregates (e.g. "blimp: 0.778")
63
  parts = []
64
  for g_name, g_data in groups.items():
65
  if not isinstance(g_data, dict):
 
71
  if not mname.endswith("_stderr"):
72
  parts.append(f"{g_name}: {v:.3f}")
73
  break
74
+ if parts:
75
+ return "; ".join(parts)
76
+
77
+ if not tasks:
78
+ return "—"
79
+
80
+ # Few tasks: show each by name so the benchmark is identifiable
81
+ if len(tasks) <= 5:
82
+ task_parts = []
83
+ for t in tasks:
84
+ first_m = next(iter(t["metrics"]), None)
85
+ if first_m:
86
+ task_parts.append(f"{t['name']}: {t['metrics'][first_m]['value']:.3f}")
87
+ else:
88
+ task_parts.append(t["name"])
89
+ return "; ".join(task_parts)
90
+
91
+ # Many tasks without a group: avg of the primary metric
92
+ first_m = next(iter(tasks[0]["metrics"]), None)
93
+ if first_m:
94
+ vals = [t["metrics"][first_m]["value"] for t in tasks if first_m in t["metrics"]]
95
+ if vals:
96
+ return f"avg {first_m}: {sum(vals)/len(vals):.3f} (n={len(tasks)})"
97
+ return "—"
98
 
99
 
100
  def load_runs(force: bool = False) -> tuple[list, str | None]: