Commit
·
6d0599e
1
Parent(s):
25da418
Update tatoeba_mt.py (#2)
Browse files- Update tatoeba_mt.py (73684a48dd780429fbe29193fd8b6e3ef5db058a)
- Update tatoeba_mt.py (14d37af0d921e2d2981df70d3c8e36af1bf0adf1)
- tmp (09f45a917b6cbf5f592d7773109463b032093db3)
- Update tatoeba_mt.py (c82529271daebadefad2353720bf9c555a914b73)
- Update tatoeba_mt.py (842eb26634a9775f504bb2f3f43cd4cc5f9314d8)
Co-authored-by: Niklas Muennighoff <Muennighoff@users.noreply.huggingface.co>
- 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 |
|