Update tatoeba_mt.py
#2
by
Muennighoff
- opened
- tatoeba_mt.py +30 -24
tatoeba_mt.py
CHANGED
@@ -109,31 +109,37 @@ class tatoebaMT(datasets.GeneratorBasedBuilder):
|
|
109 |
|
110 |
lang_pair = self.config.language_pair
|
111 |
# release = self.config.release
|
112 |
-
|
113 |
-
files = {
|
114 |
-
|
115 |
-
|
116 |
-
|
117 |
-
|
118 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
output = []
|
120 |
-
|
121 |
-
|
122 |
-
|
123 |
-
|
124 |
-
|
125 |
-
|
126 |
-
|
127 |
-
|
128 |
-
|
129 |
-
|
130 |
-
|
131 |
-
|
132 |
-
|
133 |
-
|
134 |
-
|
135 |
-
|
136 |
-
|
137 |
|
138 |
return output
|
139 |
|
|
|
109 |
|
110 |
lang_pair = self.config.language_pair
|
111 |
# release = self.config.release
|
112 |
+
|
113 |
+
files = {}
|
114 |
+
|
115 |
+
test_path = os.path.join("test", f"tatoeba-test.{lang_pair}.tsv")
|
116 |
+
files["test"] = test_path
|
117 |
+
valid_path = os.path.join("test", f"tatoeba-dev.{lang_pair}.tsv")
|
118 |
+
files["validation"] = valid_path
|
119 |
+
try:
|
120 |
+
data_dir = dl_manager.download_and_extract(files)
|
121 |
+
except:
|
122 |
+
files.pop("validation")
|
123 |
+
data_dir = dl_manager.download_and_extract(files)
|
124 |
+
|
125 |
output = []
|
126 |
+
if "test" in files:
|
127 |
+
test = datasets.SplitGenerator(
|
128 |
+
name=datasets.Split.TEST,
|
129 |
+
gen_kwargs={
|
130 |
+
"filepath": data_dir["test"]
|
131 |
+
}
|
132 |
+
)
|
133 |
+
output.append(test)
|
134 |
+
|
135 |
+
if "validation" in files:
|
136 |
+
valid = datasets.SplitGenerator(
|
137 |
+
name=datasets.Split.VALIDATION,
|
138 |
+
gen_kwargs={
|
139 |
+
"filepath": data_dir["validation"]
|
140 |
+
}
|
141 |
+
)
|
142 |
+
output.append(valid)
|
143 |
|
144 |
return output
|
145 |
|