Delete humaneval_infilling.py
Browse files- humaneval_infilling.py +0 -80
humaneval_infilling.py
DELETED
|
@@ -1,80 +0,0 @@
|
|
| 1 |
-
import json
|
| 2 |
-
import datasets
|
| 3 |
-
|
| 4 |
-
logger = datasets.logging.get_logger(__name__)
|
| 5 |
-
|
| 6 |
-
_CITATION = """\
|
| 7 |
-
@article{bavarian2022efficient,
|
| 8 |
-
title={Efficient Training of Language Models to Fill in the Middle},
|
| 9 |
-
author={Bavarian, Mohammad and Jun, Heewoo and Tezak, Nikolas and Schulman, John and McLeavey, Christine and Tworek, Jerry and Chen, Mark},
|
| 10 |
-
journal={arXiv preprint arXiv:2207.14255},
|
| 11 |
-
year={2022}
|
| 12 |
-
}
|
| 13 |
-
"""
|
| 14 |
-
|
| 15 |
-
_DESCRIPTION = """\
|
| 16 |
-
An evaluation benchamrk for infilling tasks on HumanEval dataset for code generation.
|
| 17 |
-
"""
|
| 18 |
-
|
| 19 |
-
_SUBSETS = [ "MultiLineInfilling", "SingleLineInfilling", "RandomSpanInfilling", "RandomSpanInfillingLight" ]
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
class HumanevalConfig(datasets.BuilderConfig):
|
| 23 |
-
"""BuilderConfig for HumanevalConfig."""
|
| 24 |
-
|
| 25 |
-
def __init__(
|
| 26 |
-
self,
|
| 27 |
-
subset,
|
| 28 |
-
**kwargs,
|
| 29 |
-
):
|
| 30 |
-
self.subset = subset
|
| 31 |
-
name = f"HumanEval-{subset}"
|
| 32 |
-
kwargs["name"] = name
|
| 33 |
-
super(HumanevalConfig, self).__init__(**kwargs)
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
class MultiPLE(datasets.GeneratorBasedBuilder):
|
| 37 |
-
BUILDER_CONFIG_CLASS = HumanevalConfig
|
| 38 |
-
|
| 39 |
-
BUILDER_CONFIGS = [
|
| 40 |
-
HumanevalConfig(
|
| 41 |
-
subset=subset,
|
| 42 |
-
version=datasets.Version("1.0.0"))
|
| 43 |
-
for subset in _SUBSETS
|
| 44 |
-
]
|
| 45 |
-
|
| 46 |
-
DEFAULT_CONFIG_NAME = "HumanEval-SingleLineInfilling"
|
| 47 |
-
|
| 48 |
-
def _info(self):
|
| 49 |
-
return datasets.DatasetInfo(
|
| 50 |
-
description=_DESCRIPTION,
|
| 51 |
-
license="MIT",
|
| 52 |
-
features = datasets.Features({'task_id': datasets.Value(dtype='string'),
|
| 53 |
-
'entry_point': datasets.Value(dtype='string'),
|
| 54 |
-
'prompt': datasets.Value(dtype='string'),
|
| 55 |
-
'suffix': datasets.Value(dtype='string'),
|
| 56 |
-
'canonical_solution': datasets.Value(dtype='string'),
|
| 57 |
-
'test': datasets.Value(dtype='string')}),
|
| 58 |
-
supervised_keys=None,
|
| 59 |
-
homepage="https://github.com/openai/human-eval-infilling",
|
| 60 |
-
citation=_CITATION
|
| 61 |
-
)
|
| 62 |
-
|
| 63 |
-
def _split_generators(self, dl_manager: datasets.DownloadManager):
|
| 64 |
-
files = dl_manager.download(
|
| 65 |
-
f"data/{self.config.name}.jsonl"
|
| 66 |
-
)
|
| 67 |
-
return [
|
| 68 |
-
datasets.SplitGenerator(
|
| 69 |
-
name=datasets.Split.TEST,
|
| 70 |
-
gen_kwargs={
|
| 71 |
-
"filepath": files,
|
| 72 |
-
}
|
| 73 |
-
)
|
| 74 |
-
]
|
| 75 |
-
|
| 76 |
-
def _generate_examples(self, filepath):
|
| 77 |
-
with open(filepath) as f:
|
| 78 |
-
for id, line in enumerate(f):
|
| 79 |
-
row = json.loads(line)
|
| 80 |
-
yield id, row
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|