obrmmk commited on
Commit
47004a4
1 Parent(s): 8b4e076

Create jhumaneval.py

Browse files
Files changed (1) hide show
  1. jhumaneval.py +63 -0
jhumaneval.py ADDED
@@ -0,0 +1,63 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ import datasets
3
+
4
+
5
+ _DESCRIPTION = """\
6
+ 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".
7
+ """
8
+
9
+ _URL = "https://raw.githubusercontent.com/KuramitsuLab/jhuman-eval/main/data/jhuman-eval.jsonl.gz"
10
+
11
+ _LICENSE = "MIT"
12
+
13
+
14
+ class JHumaneval(datasets.GeneratorBasedBuilder):
15
+ VERSION = datasets.Version("0.1.0")
16
+
17
+ BUILDER_CONFIGS = [
18
+ datasets.BuilderConfig(
19
+ name="jhumaneval",
20
+ version=VERSION,
21
+ description=_DESCRIPTION,
22
+ )
23
+ ]
24
+
25
+ def _info(self):
26
+ features = datasets.Features(
27
+ {
28
+ "task_id": datasets.Value("string"),
29
+ "prompt_en": datasets.Value("string"),
30
+ "prompt": datasets.Value("string"),
31
+ "entry_point": datasets.Value("string"),
32
+ "canonical_solution": datasets.Value("string"),
33
+ "test": datasets.Value("string"),
34
+ }
35
+ )
36
+
37
+ return datasets.DatasetInfo(
38
+ description=_DESCRIPTION,
39
+ features=features,
40
+ supervised_keys=None,
41
+ license=_LICENSE,
42
+ )
43
+
44
+ def _split_generators(self, dl_manager):
45
+ """Returns SplitGenerators."""
46
+ data_dir = dl_manager.download_and_extract(_URL)
47
+ return [
48
+ datasets.SplitGenerator(
49
+ name=datasets.Split.TEST,
50
+ gen_kwargs={
51
+ "filepath": data_dir,
52
+ },
53
+ )
54
+ ]
55
+
56
+ def _generate_examples(self, filepath):
57
+ """Yields examples."""
58
+ with open(filepath, encoding="utf-8") as file:
59
+ data = [json.loads(line) for line in file]
60
+ id_ = 0
61
+ for sample in data:
62
+ yield id_, sample
63
+ id_ += 1