Bram Vanroy
commited on
Commit
•
575d1cf
1
Parent(s):
fc44f1d
fix generate overview
Browse files
generate_overview_json.py
CHANGED
@@ -16,8 +16,7 @@ def main():
|
|
16 |
for pfin in evals_dir.rglob("*.json"):
|
17 |
if pfin.stem == "models":
|
18 |
continue
|
19 |
-
short_name = pfin.stem.split("_")[2].lower()
|
20 |
-
|
21 |
data = json.loads(pfin.read_text(encoding="utf-8"))
|
22 |
if "config" not in data:
|
23 |
continue
|
@@ -33,12 +32,12 @@ def main():
|
|
33 |
results[short_name] = {
|
34 |
"model_name": model_args["pretrained"],
|
35 |
"compute_dtype": model_args.get("dtype", None),
|
36 |
-
"quantization": None
|
|
|
|
|
|
|
37 |
}
|
38 |
|
39 |
-
if "num_parameters" not in results[short_name]:
|
40 |
-
results[short_name]["num_parameters"] = get_num_parameters(model_args["pretrained"])
|
41 |
-
|
42 |
if "load_in_8bit" in model_args:
|
43 |
results[short_name]["quantization"] = "8-bit"
|
44 |
elif "load_in_4bit" in model_args:
|
@@ -47,5 +46,5 @@ def main():
|
|
47 |
pf_overview.write_text(json.dumps(results, indent=4, sort_keys=True), encoding="utf-8")
|
48 |
|
49 |
|
50 |
-
if __name__ ==
|
51 |
-
main()
|
|
|
16 |
for pfin in evals_dir.rglob("*.json"):
|
17 |
if pfin.stem == "models":
|
18 |
continue
|
19 |
+
short_name = pfin.stem.split("_", 2)[2].lower()
|
|
|
20 |
data = json.loads(pfin.read_text(encoding="utf-8"))
|
21 |
if "config" not in data:
|
22 |
continue
|
|
|
32 |
results[short_name] = {
|
33 |
"model_name": model_args["pretrained"],
|
34 |
"compute_dtype": model_args.get("dtype", None),
|
35 |
+
"quantization": None,
|
36 |
+
"num_parameters": results[short_name]["num_parameters"]
|
37 |
+
if short_name in results and "num_parameters" in results[short_name]
|
38 |
+
else get_num_parameters(model_args["pretrained"]),
|
39 |
}
|
40 |
|
|
|
|
|
|
|
41 |
if "load_in_8bit" in model_args:
|
42 |
results[short_name]["quantization"] = "8-bit"
|
43 |
elif "load_in_4bit" in model_args:
|
|
|
46 |
pf_overview.write_text(json.dumps(results, indent=4, sort_keys=True), encoding="utf-8")
|
47 |
|
48 |
|
49 |
+
if __name__ == "__main__":
|
50 |
+
main()
|