Spaces:
Runtime error
Runtime error
Delete generate_pandalm.py
Browse files- generate_pandalm.py +0 -44
generate_pandalm.py
DELETED
|
@@ -1,44 +0,0 @@
|
|
| 1 |
-
import os
|
| 2 |
-
import json
|
| 3 |
-
|
| 4 |
-
json_path1 = "llama_adapter_7b.json"
|
| 5 |
-
json_path2 = "alpaca_lora_7b.json"
|
| 6 |
-
out_path = "llama_adapter_vs_alpaca_lora.json"
|
| 7 |
-
|
| 8 |
-
data1 = open(json_path1).readlines()
|
| 9 |
-
data2 = open(json_path2).readlines()
|
| 10 |
-
question = open('question.jsonl').readlines()
|
| 11 |
-
|
| 12 |
-
assert len(data1) == len(data2) == len(question)
|
| 13 |
-
|
| 14 |
-
out_data = []
|
| 15 |
-
for i, (d1, d2, q) in enumerate(zip(data1, data2, question)):
|
| 16 |
-
d1 = json.loads(d1)
|
| 17 |
-
d2 = json.loads(d2)
|
| 18 |
-
q = json.loads(q)
|
| 19 |
-
out_d = {
|
| 20 |
-
'question_id': i,
|
| 21 |
-
'instruction': q['text'],
|
| 22 |
-
'input': '',
|
| 23 |
-
"response1": d1['text'],
|
| 24 |
-
"response2": d2['text'],
|
| 25 |
-
}
|
| 26 |
-
out_data.append(out_d)
|
| 27 |
-
|
| 28 |
-
# remove bias
|
| 29 |
-
for i, (d1, d2, q) in enumerate(zip(data2, data1, question)):
|
| 30 |
-
d1 = json.loads(d1)
|
| 31 |
-
d2 = json.loads(d2)
|
| 32 |
-
q = json.loads(q)
|
| 33 |
-
out_d = {
|
| 34 |
-
'question_id': i+80,
|
| 35 |
-
'instruction': q['text'],
|
| 36 |
-
'input': '',
|
| 37 |
-
"response1": d1['text'],
|
| 38 |
-
"response2": d2['text'],
|
| 39 |
-
}
|
| 40 |
-
out_data.append(out_d)
|
| 41 |
-
|
| 42 |
-
with open(out_path, 'w') as f:
|
| 43 |
-
# f.write("\n".join([json.dumps(x) for x in out_data]))
|
| 44 |
-
json.dump(out_data, f)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|