Upload folder using huggingface_hub
Browse files- codemmlu.py +24 -32
codemmlu.py
CHANGED
@@ -46,40 +46,31 @@ _SUBJECTS = [
|
|
46 |
]
|
47 |
|
48 |
|
49 |
-
class CodeMMLUConfig(datasets.BuilderConfig):
|
50 |
-
"""BuilderConfig for SuperGLUE."""
|
51 |
-
|
52 |
-
def __init__(self, features, data_url, **kwargs):
|
53 |
-
"""BuilderConfig for CodeMMLU.
|
54 |
-
"""
|
55 |
-
# Version history:
|
56 |
-
# 0.0.1: Initial release.
|
57 |
-
super().__init__(version=datasets.Version("0.0.1"), **kwargs)
|
58 |
-
self.features = features
|
59 |
-
self.data_url = data_url
|
60 |
-
|
61 |
-
CONFIGS = []
|
62 |
-
for sub in _SUBJECTS:
|
63 |
-
features = ['task_id', 'question', 'choices']
|
64 |
-
if sub == "fill_in_the_middle":
|
65 |
-
features.append('problem_description')
|
66 |
-
|
67 |
-
CONFIGS.append(CodeMMLUConfig(
|
68 |
-
name=sub,
|
69 |
-
features=features,
|
70 |
-
data_url=os.path.join(_URL, sub + ".jsonl"),
|
71 |
-
description="CodeMMLU test subject {}".format(sub),
|
72 |
-
))
|
73 |
-
|
74 |
-
|
75 |
class CodeMMLU(datasets.GeneratorBasedBuilder):
|
76 |
"""CodeMMLU: A Multi-Task Benchmark for Assessing Code Understanding Capabilities"""
|
77 |
-
|
78 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
|
80 |
-
def __init__(self, **config_kwargs):
|
81 |
-
super().__init__(**config_kwargs)
|
82 |
-
print(self.BUILDER_CONFIGS)
|
83 |
|
84 |
def _info(self):
|
85 |
features = datasets.Features(
|
@@ -102,7 +93,8 @@ class CodeMMLU(datasets.GeneratorBasedBuilder):
|
|
102 |
|
103 |
def _split_generators(self, dl_manager):
|
104 |
"""Returns SplitGenerators."""
|
105 |
-
|
|
|
106 |
return [
|
107 |
datasets.SplitGenerator(
|
108 |
name=datasets.Split.TEST,
|
|
|
46 |
]
|
47 |
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
class CodeMMLU(datasets.GeneratorBasedBuilder):
|
50 |
"""CodeMMLU: A Multi-Task Benchmark for Assessing Code Understanding Capabilities"""
|
51 |
+
# Version history:
|
52 |
+
# 0.0.1: Initial release.
|
53 |
+
VERSION = datasets.Version("0.0.1")
|
54 |
+
|
55 |
+
# BUILDER_CONFIGS = [
|
56 |
+
# datasets.BuilderConfig(
|
57 |
+
# name=sub, version=VERSION,
|
58 |
+
# description="CodeMMLU test subject {}".format(sub)
|
59 |
+
# ) for sub in _SUBJECTS
|
60 |
+
# ]
|
61 |
+
|
62 |
+
BUILDER_CONFIGS = [
|
63 |
+
datasets.BuilderConfig(name="programming_syntax", version=VERSION, description="CodeMMLU test subject: Programming language syntax "),
|
64 |
+
datasets.BuilderConfig(name="api_frameworks", version=VERSION, description="CodeMMLU test subject: API & Frameworks "),
|
65 |
+
datasets.BuilderConfig(name="software_principles", version=VERSION, description="CodeMMLU test subject: Software Principles "),
|
66 |
+
datasets.BuilderConfig(name="dbms_sql", version=VERSION, description="CodeMMLU test subject: DBMS & SQL "),
|
67 |
+
datasets.BuilderConfig(name="others", version=VERSION, description="CodeMMLU test subject: Others "),
|
68 |
+
datasets.BuilderConfig(name="code_completion", version=VERSION, description="CodeMMLU test subject: Code Completion "),
|
69 |
+
datasets.BuilderConfig(name="fill_in_the_middle", version=VERSION, description="CodeMMLU test subject: Fill in the Middle "),
|
70 |
+
datasets.BuilderConfig(name="code_repair", version=VERSION, description="CodeMMLU test subject: Code Repair "),
|
71 |
+
datasets.BuilderConfig(name="defect_detection", version=VERSION, description="CodeMMLU test subject: Defect Detection "),
|
72 |
+
]
|
73 |
|
|
|
|
|
|
|
74 |
|
75 |
def _info(self):
|
76 |
features = datasets.Features(
|
|
|
93 |
|
94 |
def _split_generators(self, dl_manager):
|
95 |
"""Returns SplitGenerators."""
|
96 |
+
path = os.path.join(_URL, self.config.name + ".jsonl")
|
97 |
+
dl_dir = dl_manager.download(path)
|
98 |
return [
|
99 |
datasets.SplitGenerator(
|
100 |
name=datasets.Split.TEST,
|