Delete spite.py
Browse files
spite.py
DELETED
|
@@ -1,64 +0,0 @@
|
|
| 1 |
-
import datasets
|
| 2 |
-
|
| 3 |
-
_LANGUAGE_PAIRS = {
|
| 4 |
-
"en_de": "data/en_de.parquet",
|
| 5 |
-
"en_es": "data/en_es.parquet",
|
| 6 |
-
"en_fr": "data/en_fr.parquet",
|
| 7 |
-
"en_it": "data/en_it.parquet",
|
| 8 |
-
"en_ko": "data/en_ko.parquet",
|
| 9 |
-
"en_nl": "data/en_nl.parquet",
|
| 10 |
-
"en_pt": "data/en_pt.parquet",
|
| 11 |
-
"en_ru": "data/en_ru.parquet",
|
| 12 |
-
"en_zh": "data/en_zh.parquet",
|
| 13 |
-
}
|
| 14 |
-
|
| 15 |
-
VERSION = datasets.Version("1.0.0")
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
class Spite(datasets.GeneratorBasedBuilder):
|
| 19 |
-
VERSION = VERSION
|
| 20 |
-
|
| 21 |
-
BUILDER_CONFIGS = [
|
| 22 |
-
datasets.BuilderConfig(
|
| 23 |
-
name=lang_pair,
|
| 24 |
-
version=VERSION,
|
| 25 |
-
description=f"Training data for language pair: {lang_pair}",
|
| 26 |
-
)
|
| 27 |
-
for lang_pair in _LANGUAGE_PAIRS
|
| 28 |
-
]
|
| 29 |
-
|
| 30 |
-
DEFAULT_CONFIG_NAME = "en_de"
|
| 31 |
-
|
| 32 |
-
def _info(self):
|
| 33 |
-
return datasets.DatasetInfo(
|
| 34 |
-
description="Pseudolabeled speech translation dataset",
|
| 35 |
-
features=datasets.Features({
|
| 36 |
-
"src": datasets.Value("string"),
|
| 37 |
-
"mt": datasets.Value("string"),
|
| 38 |
-
'cometqe_22': datasets.Value("float64"),
|
| 39 |
-
'xcomet_xl': datasets.Value("float64"),
|
| 40 |
-
'blaser2_src': datasets.Value("float64"),
|
| 41 |
-
'audio_length': datasets.Value("float64"),
|
| 42 |
-
"example_id": datasets.Value("string"),
|
| 43 |
-
"index": datasets.Value("int64")
|
| 44 |
-
# add more columns if needed
|
| 45 |
-
}),
|
| 46 |
-
supervised_keys=None,
|
| 47 |
-
)
|
| 48 |
-
|
| 49 |
-
def _split_generators(self, dl_manager):
|
| 50 |
-
parquet_path = dl_manager.download(_LANGUAGE_PAIRS[self.config.name])
|
| 51 |
-
|
| 52 |
-
return [
|
| 53 |
-
datasets.SplitGenerator(
|
| 54 |
-
name=datasets.Split.TRAIN,
|
| 55 |
-
gen_kwargs={"filepath": parquet_path},
|
| 56 |
-
)
|
| 57 |
-
]
|
| 58 |
-
|
| 59 |
-
def _generate_examples(self, filepath):
|
| 60 |
-
import pyarrow.parquet as pq
|
| 61 |
-
|
| 62 |
-
table = pq.read_table(filepath)
|
| 63 |
-
for idx, row in enumerate(table.to_pylist()):
|
| 64 |
-
yield idx, row
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|