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

Remove extra period in task BigCodeBench/16 #38

Merged
merged 2 commits into from
Sep 10, 2024
Merged
Changes from 1 commit
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
59 changes: 59 additions & 0 deletions tools/fix_020.py
hvaara marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
from datasets import load_dataset, Dataset, DatasetDict
from huggingface_hub import HfApi

import json
import copy

BIGCODEBENCH_HF = "bigcode/bigcodebench"
BIGCODEBENCH_HARD_HF = "bigcode/bigcodebench-hard"
BIGCODEBENCH_VERSION = "v0.1.0_hf"
BIGCODEBENCH_UPDATE = "bigcode/bcb_update"
BIGCODEBENCH_NEW_VERSION = "v0.1.1" # TODO(hvaara): [DO NOT MERGE] Figure out which version we're targeting
hvaara marked this conversation as resolved.
Show resolved Hide resolved


def map_ds(sample):

if sample["task_id"] in ["BigCodeBench/16"]:
for k in sample.keys():
sample[k] = sample[k].replace(
"No logs found to backup.", "No logs found to backup"
)

return sample


if __name__ == "__main__":
api = HfApi()
ds_dict = load_dataset(BIGCODEBENCH_HF)
hard_ds_dict = load_dataset(BIGCODEBENCH_HARD_HF)
ds = ds_dict[BIGCODEBENCH_VERSION]
hard_ds = hard_ds_dict[BIGCODEBENCH_VERSION]
function_id = [16]

new_ds = ds.map(map_ds)
new_ds.to_json("BigCodeBench.jsonl")
ds_dict[BIGCODEBENCH_NEW_VERSION] = new_ds
ds_dict.push_to_hub(BIGCODEBENCH_HF)

new_hard_ds = hard_ds.map(map_ds)
new_hard_ds.to_json("BigCodeBench-Hard.jsonl")
hard_ds_dict[BIGCODEBENCH_NEW_VERSION] = new_hard_ds
hard_ds_dict.push_to_hub(BIGCODEBENCH_HARD_HF)

for i in function_id:
old_sample = ds.select([i])
new_sample = new_ds.select([i])
old_sample.to_json("old.jsonl")
new_sample.to_json("new.jsonl")
api.upload_file(
path_or_fileobj="old.jsonl",
path_in_repo=f"{i}/old.jsonl",
repo_id=BIGCODEBENCH_UPDATE,
# repo_type="dataset"
)
api.upload_file(
path_or_fileobj="new.jsonl",
path_in_repo=f"{i}/new.jsonl",
repo_id=BIGCODEBENCH_UPDATE,
# repo_type="dataset"
)