Datasets:
File size: 1,886 Bytes
47004a4 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
import json
import datasets
_DESCRIPTION = """\
This is a Japanese translated version of HumanEval, an evaluation harness for the HumanEval problem solving dataset described in the paper "Evaluating Large Language Models Trained on Code".
"""
_URL = "https://raw.githubusercontent.com/KuramitsuLab/jhuman-eval/main/data/jhuman-eval.jsonl.gz"
_LICENSE = "MIT"
class JHumaneval(datasets.GeneratorBasedBuilder):
VERSION = datasets.Version("0.1.0")
BUILDER_CONFIGS = [
datasets.BuilderConfig(
name="jhumaneval",
version=VERSION,
description=_DESCRIPTION,
)
]
def _info(self):
features = datasets.Features(
{
"task_id": datasets.Value("string"),
"prompt_en": datasets.Value("string"),
"prompt": datasets.Value("string"),
"entry_point": datasets.Value("string"),
"canonical_solution": datasets.Value("string"),
"test": datasets.Value("string"),
}
)
return datasets.DatasetInfo(
description=_DESCRIPTION,
features=features,
supervised_keys=None,
license=_LICENSE,
)
def _split_generators(self, dl_manager):
"""Returns SplitGenerators."""
data_dir = dl_manager.download_and_extract(_URL)
return [
datasets.SplitGenerator(
name=datasets.Split.TEST,
gen_kwargs={
"filepath": data_dir,
},
)
]
def _generate_examples(self, filepath):
"""Yields examples."""
with open(filepath, encoding="utf-8") as file:
data = [json.loads(line) for line in file]
id_ = 0
for sample in data:
yield id_, sample
id_ += 1 |