Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

humaneval jsonl support #75

Merged
merged 2 commits into from
Dec 5, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions translation/dump.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import json
import os


def extract_prompt_from_file(file_path):
Expand All @@ -11,9 +12,10 @@ def extract_prompt_from_file(file_path):

def hinglish_json():
# File path to the JSON file
file_path = "../HumanEval.json"
with open(file_path, "r") as json_file:
data = json.load(json_file)
base_dir = os.path.dirname(__file__)
path_humaneval = os.path.join(base_dir, "HumanEval.jsonl")
with open(path_humaneval, "r") as jsonl_file:
data = [json.loads(line) for line in jsonl_file.readlines()]

# modify the data with the hinglish prompts
new_data, index = [], 0
Expand All @@ -37,7 +39,7 @@ def hinglish_json():
new_data.append(item)

# write the new data to the json file
with open("../HinglishEval.json", "w") as json_file:
with open(os.path.join(base_dir, "HinglishEval.json"), "w") as json_file:
json.dump(data, json_file)


Expand Down
Loading