DouDou commited on
Upload data2/step22/alignment.py with huggingface_hub
Browse files- data2/step22/alignment.py +16 -0
data2/step22/alignment.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import jsonlines
|
| 2 |
+
|
| 3 |
+
|
| 4 |
+
results = {}
|
| 5 |
+
with jsonlines.open("/home/weifengsun/tangou1/step2/step22/output/gemini_results.jsonl", "r") as reader:
|
| 6 |
+
for obj in reader:
|
| 7 |
+
results[obj["idx"]] = obj
|
| 8 |
+
|
| 9 |
+
with jsonlines.open("/home/weifengsun/tangou1/step2/step22/output/function_filtered_scores.jsonl", "r") as reader, jsonlines.open("/home/weifengsun/tangou1/step2/step22/output/alignment.jsonl", "w") as writer:
|
| 10 |
+
for idx, obj in enumerate(reader):
|
| 11 |
+
if idx not in results:
|
| 12 |
+
continue
|
| 13 |
+
obj["results"] = results[idx]
|
| 14 |
+
writer.write(obj)
|
| 15 |
+
|
| 16 |
+
|