Datasets:
Fixed?
Browse files- multipl_e.py +8 -14
multipl_e.py
CHANGED
@@ -1,5 +1,6 @@
|
|
1 |
import json
|
2 |
import datasets
|
|
|
3 |
|
4 |
logger = datasets.logging.get_logger(__name__)
|
5 |
|
@@ -33,20 +34,17 @@ _LANGUAGES = [
|
|
33 |
|
34 |
_VARIATIONS = [ "keep", "transform", "reworded", "remove" ]
|
35 |
|
36 |
-
class MultiPLEConfig(datasets.BuilderConfig):
|
37 |
-
|
38 |
-
def __init__(self, language, variation):
|
39 |
-
super(MultiPLEConfig, self).__init__(version=datasets.Version("1.0.0"))
|
40 |
-
self.name = language + "-" + variation
|
41 |
-
self.language = language
|
42 |
-
self.variation = variation
|
43 |
-
|
44 |
|
45 |
class MultiPLE(datasets.GeneratorBasedBuilder):
|
46 |
|
47 |
BUILDER_CONFIGS = [
|
48 |
-
|
|
|
|
|
|
|
|
|
49 |
]
|
|
|
50 |
def _info(self):
|
51 |
return datasets.DatasetInfo(
|
52 |
description=_DESCRIPTION,
|
@@ -68,11 +66,8 @@ class MultiPLE(datasets.GeneratorBasedBuilder):
|
|
68 |
)
|
69 |
|
70 |
def _split_generators(self, dl_manager: datasets.DownloadManager):
|
71 |
-
language = self.config.language
|
72 |
-
variation = self.config.variation
|
73 |
files = dl_manager.download_and_extract(
|
74 |
-
f"https://huggingface.co/datasets/nuprl/MultiPL-E/raw/main/data/{
|
75 |
-
|
76 |
return [
|
77 |
datasets.SplitGenerator(
|
78 |
name=datasets.Split.TEST,
|
@@ -84,7 +79,6 @@ class MultiPLE(datasets.GeneratorBasedBuilder):
|
|
84 |
]
|
85 |
|
86 |
def _generate_examples(self, filepath, split):
|
87 |
-
logger.info("⏳ Generating examples from = %s", filepath)
|
88 |
with open(filepath, encoding="utf-8") as f:
|
89 |
data = json.load(f)
|
90 |
for id_, row in enumerate(data):
|
|
|
1 |
import json
|
2 |
import datasets
|
3 |
+
from pathlib import Path
|
4 |
|
5 |
logger = datasets.logging.get_logger(__name__)
|
6 |
|
|
|
34 |
|
35 |
_VARIATIONS = [ "keep", "transform", "reworded", "remove" ]
|
36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
37 |
|
38 |
class MultiPLE(datasets.GeneratorBasedBuilder):
|
39 |
|
40 |
BUILDER_CONFIGS = [
|
41 |
+
datasets.BuilderConfig(
|
42 |
+
name = language + "-" + variation,
|
43 |
+
version=datasets.Version("1.0.0"),
|
44 |
+
description=_DESCRIPTION)
|
45 |
+
for language in _LANGUAGES for variation in _VARIATIONS
|
46 |
]
|
47 |
+
|
48 |
def _info(self):
|
49 |
return datasets.DatasetInfo(
|
50 |
description=_DESCRIPTION,
|
|
|
66 |
)
|
67 |
|
68 |
def _split_generators(self, dl_manager: datasets.DownloadManager):
|
|
|
|
|
69 |
files = dl_manager.download_and_extract(
|
70 |
+
f"https://huggingface.co/datasets/nuprl/MultiPL-E/raw/main/data/{self.config.name}.json")
|
|
|
71 |
return [
|
72 |
datasets.SplitGenerator(
|
73 |
name=datasets.Split.TEST,
|
|
|
79 |
]
|
80 |
|
81 |
def _generate_examples(self, filepath, split):
|
|
|
82 |
with open(filepath, encoding="utf-8") as f:
|
83 |
data = json.load(f)
|
84 |
for id_, row in enumerate(data):
|