cahya commited on
Commit
70d554c
1 Parent(s): 9e340bb

split the audio archive into audio train and test archive

Browse files
data/{librivox-indonesia.tgz → audio_test.tgz} RENAMED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:ed54facad55dff78b6d3782d384d9a45327c5477b35ec14da08eb177d73b8ed3
3
- size 321661831
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:a65e9a06b1d2ba5972d11fd82742fb7003c847723a2b9dc8287aa08c0e098890
3
+ size 31278522
data/audio_train.tgz ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:fc24a531522bcbb57fed1b4c7e396c59870cf2c04d5f001a0690a1b5e090c553
3
+ size 290337459
librivox-indonesia.py CHANGED
@@ -14,7 +14,6 @@
14
  # limitations under the License.
15
  """ LibriVox-Indonesia Dataset"""
16
 
17
-
18
  import csv
19
  import os
20
 
@@ -31,8 +30,7 @@ _HOMEPAGE = "https://huggingface.co/indonesian-nlp/librivox-indonesia"
31
 
32
  _LICENSE = "https://creativecommons.org/publicdomain/zero/1.0/"
33
 
34
- _AUDIO_URL = "https://huggingface.co/datasets/indonesian-nlp/librivox-indonesia/resolve/main/data/librivox-indonesia.tgz"
35
- _METADATA_URL = "https://huggingface.co/datasets/indonesian-nlp/librivox-indonesia/resolve/main/data"
36
 
37
 
38
  class LibriVoxIndonesiaConfig(datasets.BuilderConfig):
@@ -107,30 +105,26 @@ class LibriVoxIndonesia(datasets.GeneratorBasedBuilder):
107
  def _split_generators(self, dl_manager):
108
  """Returns SplitGenerators."""
109
  dl_manager.download_config.ignore_url_params = True
110
-
111
- audio_path = dl_manager.download(_AUDIO_URL)
112
- local_extracted_archive = dl_manager.extract(audio_path) if not dl_manager.is_streaming else None
 
 
 
 
 
113
  path_to_clips = "librivox-indonesia"
114
 
115
  return [
116
  datasets.SplitGenerator(
117
- name=datasets.Split.TRAIN,
118
- gen_kwargs={
119
- "local_extracted_archive": local_extracted_archive,
120
- "audio_files": dl_manager.iter_archive(audio_path),
121
- "metadata_path": dl_manager.download_and_extract(_METADATA_URL + "/metadata_train.csv.gz"),
122
- "path_to_clips": path_to_clips,
123
- },
124
- ),
125
- datasets.SplitGenerator(
126
- name=datasets.Split.TEST,
127
  gen_kwargs={
128
- "local_extracted_archive": local_extracted_archive,
129
- "audio_files": dl_manager.iter_archive(audio_path),
130
- "metadata_path": dl_manager.download_and_extract(_METADATA_URL + "/metadata_test.csv.gz"),
131
  "path_to_clips": path_to_clips,
132
  },
133
- ),
134
  ]
135
 
136
  def _generate_examples(
 
14
  # limitations under the License.
15
  """ LibriVox-Indonesia Dataset"""
16
 
 
17
  import csv
18
  import os
19
 
 
30
 
31
  _LICENSE = "https://creativecommons.org/publicdomain/zero/1.0/"
32
 
33
+ _DATA_URL = "https://huggingface.co/datasets/indonesian-nlp/librivox-indonesia/resolve/main/data"
 
34
 
35
 
36
  class LibriVoxIndonesiaConfig(datasets.BuilderConfig):
 
105
  def _split_generators(self, dl_manager):
106
  """Returns SplitGenerators."""
107
  dl_manager.download_config.ignore_url_params = True
108
+ audio = {}
109
+ local_extracted_archive = {}
110
+ metadata_path = {}
111
+ split_type = {"train": datasets.Split.TRAIN, "test": datasets.Split.TEST}
112
+ for split in split_type:
113
+ audio[split] = dl_manager.download(f"{_DATA_URL}/audio_{split}.tgz")
114
+ local_extracted_archive[split] = dl_manager.extract(audio[split]) if not dl_manager.is_streaming else None
115
+ metadata_path[split] = dl_manager.download_and_extract(f"{_DATA_URL}/metadata_{split}.csv.gz")
116
  path_to_clips = "librivox-indonesia"
117
 
118
  return [
119
  datasets.SplitGenerator(
120
+ name=split_type[split],
 
 
 
 
 
 
 
 
 
121
  gen_kwargs={
122
+ "local_extracted_archive": local_extracted_archive[split],
123
+ "audio_files": dl_manager.iter_archive(audio[split]),
124
+ "metadata_path": dl_manager.download_and_extract(metadata_path[split]),
125
  "path_to_clips": path_to_clips,
126
  },
127
+ ) for split in split_type
128
  ]
129
 
130
  def _generate_examples(