Datasets:
Delete en2zh.py
Browse files
en2zh.py
DELETED
@@ -1,27 +0,0 @@
|
|
1 |
-
import json
|
2 |
-
import os
|
3 |
-
from openai import OpenAI
|
4 |
-
import concurrent.futures
|
5 |
-
|
6 |
-
TASK_FOLDER = "/fs-computility/ai4sData/earth-shared/SFE/v0/mat"
|
7 |
-
|
8 |
-
client = OpenAI(
|
9 |
-
base_url="http://35.220.164.252:3888/v1",
|
10 |
-
api_key="sk-aCZEiuNpFSJcDTEDWxpubNlpOAJvzyVrBYtvVbrdmG0TbAQr"
|
11 |
-
)
|
12 |
-
|
13 |
-
def folder_processor(sub_folder_path):
|
14 |
-
for filename in os.listdir(sub_folder_path):
|
15 |
-
if filename.endswith(".jsonl"):
|
16 |
-
with open(os.path.join(sub_folder_path, filename), "r") as f:
|
17 |
-
dataset = f.readlines()
|
18 |
-
|
19 |
-
for line in dataset:
|
20 |
-
data = json.loads(line)
|
21 |
-
if data["Question Type"] == "Multiple Choice":
|
22 |
-
|
23 |
-
|
24 |
-
if __name__ == "__main__":
|
25 |
-
sub_folder_paths = [f"{TASK_FOLDER/{sub_folder_name}}" for sub_folder_name in os.listdir(TASK_FOLDER)]
|
26 |
-
with concurrent.futures.ThreadPoolExecutor(max_workers=100) as executor:
|
27 |
-
list(tqdm(executor.map(model_processor, final_indices, [model_name]*len(final_indices), [res_save_folder]*len(final_indices)), total=len(final_indices), desc="Processing files"))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|