lhoestq HF Staff commited on
Commit
47315f6
·
verified ·
1 Parent(s): b185a5e

Delete loading script

Browse files
Files changed (1) hide show
  1. humaneval-x.py +0 -132
humaneval-x.py DELETED
@@ -1,132 +0,0 @@
1
- # coding=utf-8
2
- # Copyright 2020 The HuggingFace Datasets Authors and the current dataset script contributor.
3
- #
4
- # Licensed under the Apache License, Version 2.0 (the "License");
5
- # you may not use this file except in compliance with the License.
6
- # You may obtain a copy of the License at
7
- #
8
- # http://www.apache.org/licenses/LICENSE-2.0
9
- #
10
- # Unless required by applicable law or agreed to in writing, software
11
- # distributed under the License is distributed on an "AS IS" BASIS,
12
- # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
- # See the License for the specific language governing permissions and
14
- # limitations under the License.
15
- """HumanEval-X dataset."""
16
-
17
-
18
- import json
19
- import datasets
20
-
21
-
22
-
23
- _DESCRIPTION = """
24
- HumanEval-X is a benchmark for the evaluation of the multilingual ability of code generative models. \
25
- It consists of 820 high-quality human-crafted data samples (each with test cases) in Python, C++, Java, JavaScript, and Go, and can be used for various tasks.
26
- """
27
-
28
- _HOMEPAGE = "https://github.com/THUDM/CodeGeeX"
29
-
30
- def get_url(name):
31
- url = f"data/{name}/data/humaneval.jsonl"
32
- return url
33
-
34
- def split_generator(dl_manager, name):
35
- downloaded_files = dl_manager.download(get_url(name))
36
- return [
37
- datasets.SplitGenerator(
38
- name=datasets.Split.TEST,
39
- gen_kwargs={
40
- "filepath": downloaded_files,
41
- },
42
- )
43
- ]
44
-
45
- class HumanEvalXConfig(datasets.BuilderConfig):
46
- """BuilderConfig """
47
-
48
- def __init__(self, name, description, features, **kwargs):
49
- super(HumanEvalXConfig, self).__init__(version=datasets.Version("1.0.0", ""), **kwargs)
50
- self.name = name
51
- self.description = description
52
- self.features = features
53
-
54
-
55
- class HumanEvalX(datasets.GeneratorBasedBuilder):
56
- VERSION = datasets.Version("1.0.0")
57
- BUILDER_CONFIGS = [
58
- HumanEvalXConfig(
59
- name="python",
60
- description="Python HumanEval",
61
- features=["task_id", "prompt", "declaration", "canonical_solution", "test", "example_test"]
62
- ),
63
- HumanEvalXConfig(
64
- name="cpp",
65
- description="C++ HumanEval",
66
- features=["task_id", "prompt", "declaration", "canonical_solution", "test", "example_test"]
67
- ),
68
-
69
- HumanEvalXConfig(
70
- name="go",
71
- description="Go HumanEval",
72
- features=["task_id", "prompt", "declaration", "canonical_solution", "test", "example_test"]
73
- ),
74
- HumanEvalXConfig(
75
- name="java",
76
- description="Java HumanEval",
77
- features=["task_id", "prompt", "declaration", "canonical_solution", "test", "example_test"]
78
- ),
79
-
80
- HumanEvalXConfig(
81
- name="js",
82
- description="JavaScript HumanEval",
83
- features=["task_id", "prompt", "declaration", "canonical_solution", "test", "example_test"]
84
- ),
85
- ]
86
- DEFAULT_CONFIG_NAME = "python"
87
-
88
- def _info(self):
89
- return datasets.DatasetInfo(
90
- description=_DESCRIPTION,
91
- features=datasets.Features({"task_id": datasets.Value("string"),
92
- "prompt": datasets.Value("string"),
93
- "declaration": datasets.Value("string"),
94
- "canonical_solution": datasets.Value("string"),
95
- "test": datasets.Value("string"),
96
- "example_test": datasets.Value("string"),
97
- }),
98
- homepage=_HOMEPAGE,
99
- )
100
-
101
- def _split_generators(self, dl_manager):
102
- if self.config.name == "python":
103
- return split_generator(dl_manager, self.config.name)
104
-
105
- elif self.config.name == "cpp":
106
- return split_generator(dl_manager, self.config.name)
107
-
108
- elif self.config.name == "go":
109
- return split_generator(dl_manager, self.config.name)
110
-
111
- elif self.config.name == "java":
112
- return split_generator(dl_manager, self.config.name)
113
-
114
- elif self.config.name == "js":
115
- return split_generator(dl_manager, self.config.name)
116
-
117
- def _generate_examples(self, filepath):
118
- key = 0
119
- with open(filepath) as f:
120
- for line in f:
121
- row = json.loads(line)
122
- key += 1
123
- yield key, {
124
- "task_id": row["task_id"],
125
- "prompt": row["prompt"],
126
- "declaration": row["declaration"],
127
- "canonical_solution": row["canonical_solution"],
128
- "test": row["test"],
129
- "example_test": row["example_test"],
130
-
131
- }
132
- key += 1