Johannes Janosovits commited on
Commit
bba2508
·
1 Parent(s): 0e3197c
Files changed (1) hide show
  1. app.py +13 -4
app.py CHANGED
@@ -1,6 +1,7 @@
1
  import json
2
  import os
3
  from datetime import datetime
 
4
 
5
  from huggingface_hub import HfApi, hf_hub_download
6
  from shiny import App, reactive, render, ui
@@ -89,8 +90,14 @@ def load_runs(force: bool = False) -> tuple[list, str | None]:
89
  _cache.update(runs=[], err=str(e))
90
  return [], str(e)
91
 
92
- result_files = [f for f in all_files if f.startswith("results_") and f.endswith(".json")]
93
- sample_files = {f for f in all_files if f.startswith("samples_") and f.endswith(".jsonl")}
 
 
 
 
 
 
94
 
95
  runs = []
96
  for filename in sorted(result_files, reverse=True):
@@ -101,7 +108,9 @@ def load_runs(force: bool = False) -> tuple[list, str | None]:
101
  except Exception:
102
  continue
103
 
104
- ts = filename.removeprefix("results_").removesuffix(".json")
 
 
105
  model = data.get("model_name", "unknown")
106
  date_ts = data.get("date")
107
  date_str = datetime.fromtimestamp(date_ts).strftime("%Y-%m-%d %H:%M") if date_ts else "—"
@@ -121,7 +130,7 @@ def load_runs(force: bool = False) -> tuple[list, str | None]:
121
  "value": v,
122
  "stderr": td.get(f"{mname}_stderr,{filt}"),
123
  }
124
- samples_f = f"samples_{task_name}_{ts}.jsonl"
125
  tasks.append({
126
  "name": task_name,
127
  "n": td.get("sample_len", 0),
 
1
  import json
2
  import os
3
  from datetime import datetime
4
+ from pathlib import PurePosixPath
5
 
6
  from huggingface_hub import HfApi, hf_hub_download
7
  from shiny import App, reactive, render, ui
 
90
  _cache.update(runs=[], err=str(e))
91
  return [], str(e)
92
 
93
+ result_files = [
94
+ f for f in all_files
95
+ if PurePosixPath(f).name.startswith("results_") and f.endswith(".json")
96
+ ]
97
+ sample_files = {
98
+ f for f in all_files
99
+ if PurePosixPath(f).name.startswith("samples_") and f.endswith(".jsonl")
100
+ }
101
 
102
  runs = []
103
  for filename in sorted(result_files, reverse=True):
 
108
  except Exception:
109
  continue
110
 
111
+ p = PurePosixPath(filename)
112
+ folder = p.parent.as_posix() # e.g. "Qwen__Qwen2.5-7B-Instruct"
113
+ ts = p.name.removeprefix("results_").removesuffix(".json")
114
  model = data.get("model_name", "unknown")
115
  date_ts = data.get("date")
116
  date_str = datetime.fromtimestamp(date_ts).strftime("%Y-%m-%d %H:%M") if date_ts else "—"
 
130
  "value": v,
131
  "stderr": td.get(f"{mname}_stderr,{filt}"),
132
  }
133
+ samples_f = f"{folder}/samples_{task_name}_{ts}.jsonl"
134
  tasks.append({
135
  "name": task_name,
136
  "n": td.get("sample_len", 0),