Bram Vanroy commited on
Commit
8c4485d
1 Parent(s): 5cd00f0

add data collection script

Browse files
Files changed (1) hide show
  1. generate_overview_json.py +8 -4
generate_overview_json.py CHANGED
@@ -10,13 +10,16 @@ def get_num_parameters(model_name: str) -> int:
10
 
11
 
12
  def main():
13
- results = {}
14
- for pfin in Path(__file__).parent.joinpath("evals").rglob("*.json"):
 
 
 
15
  if pfin.stem == "models":
16
  continue
17
  short_name = pfin.stem.split("_")[2]
18
- if short_name not in results:
19
- results[short_name] = {}
20
 
21
  data = json.loads(pfin.read_text(encoding="utf-8"))
22
  if "config" not in data:
@@ -41,6 +44,7 @@ def main():
41
  results[short_name]["num_parameters"] = get_num_parameters(model_args["pretrained"])
42
 
43
  pprint(results)
 
44
 
45
 
46
  if __name__ == '__main__':
 
10
 
11
 
12
  def main():
13
+ evals_dir = Path(__file__).parent.joinpath("evals")
14
+ pf_overview = evals_dir.joinpath("models.json")
15
+ results = json.loads(pf_overview.read_text(encoding="utf-8")) if pf_overview.exists() else {}
16
+
17
+ for pfin in evals_dir.rglob("*.json"):
18
  if pfin.stem == "models":
19
  continue
20
  short_name = pfin.stem.split("_")[2]
21
+ if short_name in results:
22
+ continue
23
 
24
  data = json.loads(pfin.read_text(encoding="utf-8"))
25
  if "config" not in data:
 
44
  results[short_name]["num_parameters"] = get_num_parameters(model_args["pretrained"])
45
 
46
  pprint(results)
47
+ pf_overview.write_text(json.dumps(results, indent=4), encoding="utf-8")
48
 
49
 
50
  if __name__ == '__main__':