Bram Vanroy
commited on
Commit
·
50704ab
1
Parent(s):
6d7ff83
smarter calculation of params
Browse files
generate_overview_json.py
CHANGED
@@ -18,8 +18,6 @@ def main():
|
|
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:
|
@@ -36,16 +34,17 @@ def main():
|
|
36 |
results[short_name] = {
|
37 |
"model_name": model_args["pretrained"],
|
38 |
"compute_dtype": model_args.get("dtype", None),
|
39 |
-
"quantization": None
|
40 |
-
"num_parameters": get_num_parameters(model_args["pretrained"])
|
41 |
}
|
42 |
|
|
|
|
|
|
|
43 |
if "load_in_8bit" in model_args:
|
44 |
results[short_name]["quantization"] = "8-bit"
|
45 |
elif "load_in_4bit" in model_args:
|
46 |
results[short_name]["quantization"] = "4-bit"
|
47 |
|
48 |
-
pprint(results)
|
49 |
pf_overview.write_text(json.dumps(results, indent=4), encoding="utf-8")
|
50 |
|
51 |
|
|
|
18 |
if pfin.stem == "models":
|
19 |
continue
|
20 |
short_name = pfin.stem.split("_")[2]
|
|
|
|
|
21 |
|
22 |
data = json.loads(pfin.read_text(encoding="utf-8"))
|
23 |
if "config" not in data:
|
|
|
34 |
results[short_name] = {
|
35 |
"model_name": model_args["pretrained"],
|
36 |
"compute_dtype": model_args.get("dtype", None),
|
37 |
+
"quantization": None
|
|
|
38 |
}
|
39 |
|
40 |
+
if "num_parameters" not in results[short_name]:
|
41 |
+
results[short_name]["num_parameters"] = get_num_parameters(model_args["pretrained"])
|
42 |
+
|
43 |
if "load_in_8bit" in model_args:
|
44 |
results[short_name]["quantization"] = "8-bit"
|
45 |
elif "load_in_4bit" in model_args:
|
46 |
results[short_name]["quantization"] = "4-bit"
|
47 |
|
|
|
48 |
pf_overview.write_text(json.dumps(results, indent=4), encoding="utf-8")
|
49 |
|
50 |
|