Upload folder using huggingface_hub
Browse files- codemmlu.py +29 -10
codemmlu.py
CHANGED
|
@@ -39,23 +39,38 @@ _HOMEPAGE = "https://fsoft-ai4code.github.io/codemmlu/"
|
|
| 39 |
_URL = "data.tar"
|
| 40 |
|
| 41 |
_SUBJECTS = [
|
| 42 |
-
"software_principles", "dbms_sql", "others",
|
| 43 |
"programming_syntax", "api_frameworks",
|
|
|
|
| 44 |
"code_completion", "fill_in_the_middle", "code_repair", "defect_detection"
|
| 45 |
]
|
| 46 |
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
class CodeMMLU(datasets.GeneratorBasedBuilder):
|
| 49 |
"""CodeMMLU: A Multi-Task Benchmark for Assessing Code Understanding Capabilities"""
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
|
| 61 |
def _info(self):
|
|
@@ -66,6 +81,10 @@ class CodeMMLU(datasets.GeneratorBasedBuilder):
|
|
| 66 |
"choices": datasets.features.Sequence(datasets.Value("string")),
|
| 67 |
}
|
| 68 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
| 69 |
return datasets.DatasetInfo(
|
| 70 |
description=_DESCRIPTION,
|
| 71 |
features=features,
|
|
|
|
| 39 |
_URL = "data.tar"
|
| 40 |
|
| 41 |
_SUBJECTS = [
|
|
|
|
| 42 |
"programming_syntax", "api_frameworks",
|
| 43 |
+
"software_principles", "dbms_sql", "others",
|
| 44 |
"code_completion", "fill_in_the_middle", "code_repair", "defect_detection"
|
| 45 |
]
|
| 46 |
|
| 47 |
|
| 48 |
+
class CodeMMLUConfig(datasets.BuilderConfig):
|
| 49 |
+
"""BuilderConfig for SuperGLUE."""
|
| 50 |
+
|
| 51 |
+
def __init__(self, features, **kwargs):
|
| 52 |
+
"""BuilderConfig for CodeMMLU.
|
| 53 |
+
"""
|
| 54 |
+
# Version history:
|
| 55 |
+
# 0.0.1: Initial release.
|
| 56 |
+
super().__init__(version=datasets.Version("0.0.1"), **kwargs)
|
| 57 |
+
self.features = features
|
| 58 |
+
|
| 59 |
+
|
| 60 |
class CodeMMLU(datasets.GeneratorBasedBuilder):
|
| 61 |
"""CodeMMLU: A Multi-Task Benchmark for Assessing Code Understanding Capabilities"""
|
| 62 |
+
BUILDER_CONFIG_CLASS = CodeMMLUConfig
|
| 63 |
+
BUILDER_CONFIGS = []
|
| 64 |
+
for sub in _SUBJECTS:
|
| 65 |
+
features = ['task_id', 'question', 'choices']
|
| 66 |
+
if sub == "fill_in_the_middle":
|
| 67 |
+
features.append('problem_description')
|
| 68 |
+
|
| 69 |
+
BUILDER_CONFIGS.append(CodeMMLUConfig(
|
| 70 |
+
name=sub,
|
| 71 |
+
features=features,
|
| 72 |
+
description="CodeMMLU test subject {}".format(sub),
|
| 73 |
+
))
|
| 74 |
|
| 75 |
|
| 76 |
def _info(self):
|
|
|
|
| 81 |
"choices": datasets.features.Sequence(datasets.Value("string")),
|
| 82 |
}
|
| 83 |
)
|
| 84 |
+
|
| 85 |
+
if self.config.name == "fill_in_the_middle":
|
| 86 |
+
features["problem_description"] = datasets.Value("string")
|
| 87 |
+
|
| 88 |
return datasets.DatasetInfo(
|
| 89 |
description=_DESCRIPTION,
|
| 90 |
features=features,
|