Delete gen_winograd_raw.py with huggingface_hub
Browse files- gen_winograd_raw.py +0 -81
gen_winograd_raw.py
DELETED
@@ -1,81 +0,0 @@
|
|
1 |
-
"""Gen-Winograd"""
|
2 |
-
|
3 |
-
import json
|
4 |
-
|
5 |
-
import datasets
|
6 |
-
|
7 |
-
|
8 |
-
logger = datasets.logging.get_logger(__name__)
|
9 |
-
|
10 |
-
|
11 |
-
_CITATION = """\
|
12 |
-
@misc{whitehouse2023llmpowered,
|
13 |
-
title={LLM-powered Data Augmentation for Enhanced Crosslingual Performance},
|
14 |
-
author={Chenxi Whitehouse and Monojit Choudhury and Alham Fikri Aji},
|
15 |
-
year={2023},
|
16 |
-
eprint={2305.14288},
|
17 |
-
archivePrefix={arXiv},
|
18 |
-
primaryClass={cs.CL}
|
19 |
-
}
|
20 |
-
|
21 |
-
@misc{tikhonov2021heads,
|
22 |
-
title={It's All in the Heads: Using Attention Heads as a Baseline for Cross-Lingual Transfer in Commonsense Reasoning},
|
23 |
-
author={Alexey Tikhonov and Max Ryabinin},
|
24 |
-
year={2021},
|
25 |
-
eprint={2106.12066},
|
26 |
-
archivePrefix={arXiv},
|
27 |
-
primaryClass={cs.CL}
|
28 |
-
}
|
29 |
-
"""
|
30 |
-
|
31 |
-
_DESCRIPTION = """\
|
32 |
-
English Winograd generated by GPT-4
|
33 |
-
"""
|
34 |
-
_LANG = ["en"]
|
35 |
-
_URL = "https://raw.githubusercontent.com/mbzuai-nlp/gen-X/main/data/gen-winograd/{lang}_winograd.jsonl"
|
36 |
-
_VERSION = datasets.Version("1.1.0", "")
|
37 |
-
|
38 |
-
|
39 |
-
class GenWinograd(datasets.GeneratorBasedBuilder):
|
40 |
-
"""GenWinograd"""
|
41 |
-
|
42 |
-
BUILDER_CONFIGS = [
|
43 |
-
datasets.BuilderConfig(
|
44 |
-
name=lang,
|
45 |
-
description=f"Winograd generated by GPT-4 {lang}",
|
46 |
-
version=_VERSION,
|
47 |
-
)
|
48 |
-
for lang in _LANG
|
49 |
-
]
|
50 |
-
|
51 |
-
def _info(self):
|
52 |
-
return datasets.DatasetInfo(
|
53 |
-
description=_DESCRIPTION,
|
54 |
-
features=datasets.Features(
|
55 |
-
{
|
56 |
-
"sentence": datasets.Value("string"),
|
57 |
-
"option1": datasets.Value("string"),
|
58 |
-
"option2": datasets.Value("string"),
|
59 |
-
"label": datasets.Value("int32"),
|
60 |
-
}
|
61 |
-
),
|
62 |
-
supervised_keys=None,
|
63 |
-
citation=_CITATION,
|
64 |
-
)
|
65 |
-
|
66 |
-
def _split_generators(self, dl_manager):
|
67 |
-
|
68 |
-
downloaded_files = dl_manager.download(_URL.format(lang=self.config.name))
|
69 |
-
return [
|
70 |
-
datasets.SplitGenerator(
|
71 |
-
name=datasets.Split.TRAIN, gen_kwargs={"filepath": downloaded_files}
|
72 |
-
)
|
73 |
-
]
|
74 |
-
|
75 |
-
def _generate_examples(self, filepath):
|
76 |
-
"""This function returns the examples in the raw (text) form."""
|
77 |
-
logger.info("Generating examples from = %s", filepath)
|
78 |
-
with open(filepath, "r") as f:
|
79 |
-
for idx, row in enumerate(f):
|
80 |
-
data = json.loads(row)
|
81 |
-
yield idx, data
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|