Datasets:
update on dataset
Browse files- dataset_infos.json +40 -0
- libris2s/libris2s.py → libris2s.py +32 -21
dataset_infos.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"default": {
|
| 3 |
+
"description": "LibriS2S: A German-English Speech-to-Speech Translation Corpus",
|
| 4 |
+
"citation": "@inproceedings{jeuris-niehues-2022-libris2s,\n title = \"{L}ibri{S}2{S}: A {G}erman-{E}nglish Speech-to-Speech Translation Corpus\",\n author = \"Jeuris, Pedro and Niehues, Jan\",\n booktitle = \"Proceedings of the Thirteenth Language Resources and Evaluation Conference\",\n year = \"2022\",\n url = \"https://aclanthology.org/2022.lrec-1.98\",\n pages = \"928--935\"\n}",
|
| 5 |
+
"homepage": "https://huggingface.co/datasets/PedroDKE/LibriS2S",
|
| 6 |
+
"license": "cc-by-nc-sa-4.0",
|
| 7 |
+
"features": {
|
| 8 |
+
"book_id": {
|
| 9 |
+
"dtype": "int64",
|
| 10 |
+
"_type": "Value"
|
| 11 |
+
},
|
| 12 |
+
"DE_audio": {
|
| 13 |
+
"_type": "Audio"
|
| 14 |
+
},
|
| 15 |
+
"EN_audio": {
|
| 16 |
+
"_type": "Audio"
|
| 17 |
+
},
|
| 18 |
+
"score": {
|
| 19 |
+
"dtype": "float32",
|
| 20 |
+
"_type": "Value"
|
| 21 |
+
},
|
| 22 |
+
"DE_transcript": {
|
| 23 |
+
"dtype": "string",
|
| 24 |
+
"_type": "Value"
|
| 25 |
+
},
|
| 26 |
+
"EN_transcript": {
|
| 27 |
+
"dtype": "string",
|
| 28 |
+
"_type": "Value"
|
| 29 |
+
}
|
| 30 |
+
},
|
| 31 |
+
"splits": {
|
| 32 |
+
"train": {
|
| 33 |
+
"name": "train",
|
| 34 |
+
"num_bytes": 10069085,
|
| 35 |
+
"num_examples": 25604,
|
| 36 |
+
"dataset_name": "LibriS2S"
|
| 37 |
+
}
|
| 38 |
+
}
|
| 39 |
+
}
|
| 40 |
+
}
|
libris2s/libris2s.py → libris2s.py
RENAMED
|
@@ -3,9 +3,21 @@ import os
|
|
| 3 |
from datasets import DatasetInfo, GeneratorBasedBuilder, SplitGenerator, Split, Features, Value, Audio
|
| 4 |
|
| 5 |
|
| 6 |
-
class
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 7 |
def _info(self):
|
| 8 |
return DatasetInfo(
|
|
|
|
| 9 |
features=Features({
|
| 10 |
"book_id": Value("int64"),
|
| 11 |
"DE_audio": Audio(),
|
|
@@ -14,41 +26,40 @@ class Libris2s(GeneratorBasedBuilder):
|
|
| 14 |
"DE_transcript": Value("string"),
|
| 15 |
"EN_transcript": Value("string"),
|
| 16 |
}),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 17 |
)
|
| 18 |
|
| 19 |
def _split_generators(self, dl_manager):
|
| 20 |
"""Returns SplitGenerators."""
|
| 21 |
-
if self.config.data_dir is None:
|
| 22 |
-
raise ValueError(
|
| 23 |
-
"This dataset requires you to specify the data_dir parameter in the config. "
|
| 24 |
-
"You can do this by passing --data_dir when loading the dataset."
|
| 25 |
-
)
|
| 26 |
-
|
| 27 |
return [
|
| 28 |
SplitGenerator(
|
| 29 |
name=Split.TRAIN,
|
| 30 |
gen_kwargs={
|
| 31 |
-
"
|
| 32 |
-
"
|
| 33 |
}
|
| 34 |
),
|
| 35 |
]
|
| 36 |
|
| 37 |
-
def _generate_examples(self,
|
| 38 |
"""Yields examples."""
|
| 39 |
-
|
|
|
|
|
|
|
| 40 |
reader = csv.DictReader(f)
|
| 41 |
for idx, row in enumerate(reader):
|
| 42 |
# Handle paths for both DE and EN audio
|
| 43 |
-
de_audio_path = os.path.join(
|
| 44 |
-
en_audio_path = os.path.join(
|
| 45 |
-
|
| 46 |
-
# Check if files exist
|
| 47 |
-
if not os.path.exists(de_audio_path) or not os.path.exists(en_audio_path):
|
| 48 |
-
print(f"Warning: Missing audio file(s) for index {idx}")
|
| 49 |
-
print(f"DE audio path: {de_audio_path}")
|
| 50 |
-
print(f"EN audio path: {en_audio_path}")
|
| 51 |
-
continue
|
| 52 |
|
| 53 |
yield idx, {
|
| 54 |
"book_id": int(row["book_id"]),
|
|
@@ -57,4 +68,4 @@ class Libris2s(GeneratorBasedBuilder):
|
|
| 57 |
"score": float(row["score"]),
|
| 58 |
"DE_transcript": row["DE_transcript"],
|
| 59 |
"EN_transcript": row["EN_transcript"],
|
| 60 |
-
}
|
|
|
|
| 3 |
from datasets import DatasetInfo, GeneratorBasedBuilder, SplitGenerator, Split, Features, Value, Audio
|
| 4 |
|
| 5 |
|
| 6 |
+
class LibriS2SDataset(GeneratorBasedBuilder):
|
| 7 |
+
"""LibriS2S: A German-English Speech-to-Speech Translation Corpus"""
|
| 8 |
+
|
| 9 |
+
VERSION = "1.0.0"
|
| 10 |
+
BUILDER_CONFIGS = [
|
| 11 |
+
{
|
| 12 |
+
"name": "default",
|
| 13 |
+
"version": VERSION,
|
| 14 |
+
"description": "Default configuration for LibriS2S dataset",
|
| 15 |
+
}
|
| 16 |
+
]
|
| 17 |
+
|
| 18 |
def _info(self):
|
| 19 |
return DatasetInfo(
|
| 20 |
+
description="LibriS2S: A German-English Speech-to-Speech Translation Corpus",
|
| 21 |
features=Features({
|
| 22 |
"book_id": Value("int64"),
|
| 23 |
"DE_audio": Audio(),
|
|
|
|
| 26 |
"DE_transcript": Value("string"),
|
| 27 |
"EN_transcript": Value("string"),
|
| 28 |
}),
|
| 29 |
+
homepage="https://huggingface.co/datasets/PedroDKE/LibriS2S",
|
| 30 |
+
citation="""@inproceedings{jeuris-niehues-2022-libris2s,
|
| 31 |
+
title = "{L}ibri{S}2{S}: A {G}erman-{E}nglish Speech-to-Speech Translation Corpus",
|
| 32 |
+
author = "Jeuris, Pedro and Niehues, Jan",
|
| 33 |
+
booktitle = "Proceedings of the Thirteenth Language Resources and Evaluation Conference",
|
| 34 |
+
year = "2022",
|
| 35 |
+
url = "https://aclanthology.org/2022.lrec-1.98",
|
| 36 |
+
pages = "928--935"
|
| 37 |
+
}""",
|
| 38 |
+
license="cc-by-nc-sa-4.0",
|
| 39 |
)
|
| 40 |
|
| 41 |
def _split_generators(self, dl_manager):
|
| 42 |
"""Returns SplitGenerators."""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 43 |
return [
|
| 44 |
SplitGenerator(
|
| 45 |
name=Split.TRAIN,
|
| 46 |
gen_kwargs={
|
| 47 |
+
"split": "train",
|
| 48 |
+
"cache_dir": dl_manager.manual_dir if dl_manager.manual_dir else ".",
|
| 49 |
}
|
| 50 |
),
|
| 51 |
]
|
| 52 |
|
| 53 |
+
def _generate_examples(self, split, cache_dir):
|
| 54 |
"""Yields examples."""
|
| 55 |
+
csv_path = os.path.join(cache_dir, "alignments/all_de_en_alligned_cleaned.csv")
|
| 56 |
+
|
| 57 |
+
with open(csv_path, encoding="utf-8") as f:
|
| 58 |
reader = csv.DictReader(f)
|
| 59 |
for idx, row in enumerate(reader):
|
| 60 |
# Handle paths for both DE and EN audio
|
| 61 |
+
de_audio_path = os.path.join(cache_dir, row["DE_audio"])
|
| 62 |
+
en_audio_path = os.path.join(cache_dir, row["EN_audio"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 63 |
|
| 64 |
yield idx, {
|
| 65 |
"book_id": int(row["book_id"]),
|
|
|
|
| 68 |
"score": float(row["score"]),
|
| 69 |
"DE_transcript": row["DE_transcript"],
|
| 70 |
"EN_transcript": row["EN_transcript"],
|
| 71 |
+
}
|