AuRoRA / demo_utils.py
Anni123's picture
Upload folder using huggingface_hub
b6a1d8d
raw
history blame contribute delete
No virus
971 Bytes
import os
import json
def self_construction(datatype):
demo_dir = "./demo_pool/{datatype}_demo".format(datatype=datatype)
data_dir = "./data_pool/{datatype}".format(datatype=datatype)
if os.path.exists(demo_dir):
print(demo_dir)
if os.path.exists(data_dir):
with open(data_dir, 'r') as f:
for line in f.readlines
self_construction('strategyqa')
single_data = {
'question': "asfawreg",
'datatype': "dfawds",
'base_ans': "",
'base_cots': "",
'adapter_ans': "",
'revised_cots': "",
'retrieved_knowledge': "",
'feedback': ""
}
data_dir = "./data_pool/{datatype}".format(datatype="test")
#with open(data_dir, 'a') as f:
# data_json = json.dumps(single_data)
# f.write(data_json + "\n")
with open(data_dir, 'r') as f:
for line in f.readlines():
data_dict = json.loads(line)
print(type(data_dict))