-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathdemo_json.py
More file actions
30 lines (25 loc) · 855 Bytes
/
demo_json.py
File metadata and controls
30 lines (25 loc) · 855 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import multiprocessing
import os
import src.search_methods.fastexplain as fe
import json
if __name__ == "__main__":
config_pathes = ["./configs/quantile_dev.yml", "./configs/multi_nli-albert-lds.yml"]
jsons = []
for config_path in config_pathes:
jsons.append(fe.explain_json(config_path))
try:
for i in range(len(config_pathes)):
f = open("./tmp/temp_{}.json".format(i), mode="w")
f.write(jsons[i])
f.close()
except FileNotFoundError:
os.mkdir("./tmp/")
for i in range(len(config_pathes)):
f = open("./tmp/temp_{}.json".format(i), mode="w")
f.write(jsons[i])
f.close()
f = open("tmp/temp_0.json")
jsonf = json.load(f)
f.close()
for sample_key in jsonf.keys():
print(jsonf[sample_key]["verbalization"])