| | import datasets |
| |
|
| | DESCRIPTION = """ |
| | FalAR dataset with a unified training split. |
| | All original train_* splits are merged on the fly via streaming. |
| | """ |
| |
|
| | class FalARDataset(datasets.GeneratorBasedBuilder): |
| | BUILDER_CONFIGS = [ |
| | datasets.BuilderConfig(name="default", version=datasets.Version("1.0.0")), |
| | ] |
| |
|
| | def _info(self): |
| | return datasets.DatasetInfo( |
| | description=DESCRIPTION, |
| | features={ |
| | "id": datasets.Value("string"), |
| | "text": datasets.Value("string"), |
| | "speaker": datasets.Value("string"), |
| | "wav": datasets.Audio(sampling_rate=16000), |
| | }, |
| | ) |
| |
|
| | def _split_generators(self, dl_manager): |
| |
|
| | |
| | train_splits = [ |
| | "train_0", "train_1", "train_10", "train_11", "train_12", "train_13", "train_14", "train_15", "train_2", "train_3", "train_4", "train_5", "train_6", "train_7", "train_8", "train_9" |
| | ] |
| |
|
| | return [ |
| | datasets.SplitGenerator( |
| | name=datasets.Split.TRAIN, |
| | gen_kwargs={"splits": train_splits}, |
| | ), |
| | datasets.SplitGenerator( |
| | name=datasets.Split.VALIDATION, |
| | gen_kwargs={"splits": ["dev"]}, |
| | ), |
| | datasets.SplitGenerator( |
| | name=datasets.Split.TEST, |
| | gen_kwargs={"splits": ["test"]}, |
| | ), |
| | ] |
| |
|
| | def _generate_examples(self, splits): |
| |
|
| | |
| | loaded = [ |
| | datasets.load_dataset("inesc-id/FalAR", split=split, streaming=True) |
| | for split in splits |
| | ] |
| |
|
| | idx = 0 |
| | for ds in loaded: |
| | for example in ds: |
| | yield idx, example |
| | idx += 1 |
| |
|