Datasets:

ArXiv:
License:
Anjaly commited on
Commit
7f28259
1 Parent(s): 56db810
Files changed (1) hide show
  1. snow-mountain.py +19 -74
snow-mountain.py CHANGED
@@ -97,92 +97,38 @@ class Test(datasets.GeneratorBasedBuilder):
97
  downloaded_files = dl_manager.download(_FILES[self.config.name])
98
  path_to_audios = "/".join(["data/cleaned", self.config.name])
99
 
100
- train_splits = [
101
- datasets.SplitGenerator(
102
- name="train_500",
103
- gen_kwargs={
104
- "filepath": downloaded_files["train_500"],
105
- "dl_manager": dl_manager,
106
- },
107
- ),
108
- datasets.SplitGenerator(
109
- name="train_1000",
110
- gen_kwargs={
111
- "filepath": downloaded_files["train_1000"],
112
- "dl_manager": dl_manager,
113
- },
114
- ),
115
- datasets.SplitGenerator(
116
- name="train_2500",
117
- gen_kwargs={
118
- "filepath": downloaded_files["train_2500"],
119
- "dl_manager": dl_manager,
120
- },
121
- ),
122
- datasets.SplitGenerator(
123
- name="train_short",
124
- gen_kwargs={
125
- "filepath": downloaded_files["train_short"],
126
- "dl_manager": dl_manager,
127
- },
128
- ),
129
- datasets.SplitGenerator(
130
- name="train_full",
131
- gen_kwargs={
132
- "filepath": downloaded_files["train_full"],
133
- "dl_manager": dl_manager,
134
- },
135
- ),
136
- ]
137
 
138
- dev_splits = [
139
- datasets.SplitGenerator(
140
- name="val_500",
141
- gen_kwargs={
142
- "filepath": downloaded_files["val_500"],
143
- "dl_manager": dl_manager,
144
- },
145
- ),
146
- datasets.SplitGenerator(
147
- name="val_1000",
148
- gen_kwargs={
149
- "filepath": downloaded_files["val_1000"],
150
- "dl_manager": dl_manager,
151
- },
152
- ),
153
- datasets.SplitGenerator(
154
- name="val_2500",
155
- gen_kwargs={
156
- "filepath": downloaded_files["val_2500"],
157
- "dl_manager": dl_manager,
158
- },
159
- ),
160
  datasets.SplitGenerator(
161
- name="val_short",
162
  gen_kwargs={
163
- "filepath": downloaded_files["val_short"],
164
  "dl_manager": dl_manager,
165
  },
166
- ),
 
 
167
  datasets.SplitGenerator(
168
- name="val_full",
169
  gen_kwargs={
170
- "filepath": downloaded_files["val_full"],
171
  "dl_manager": dl_manager,
172
  },
173
- ),
174
- ]
175
-
176
- test_splits = [
177
  datasets.SplitGenerator(
178
  name="test_common",
179
  gen_kwargs={
180
  "filepath": downloaded_files["test_common"],
181
  "dl_manager": dl_manager,
182
  },
183
- ),
184
- ]
185
- return train_splits + dev_splits + test_splits
186
 
187
 
188
  def _generate_examples(self, filepath, dl_manager):
@@ -192,12 +138,11 @@ class Test(datasets.GeneratorBasedBuilder):
192
  transcripts = []
193
  for index,row in data_df.iterrows():
194
  downloaded_audio = dl_manager.download(row["path"])
195
- # samplerate, audio_data = wavfile.read(downloaded_audio)
196
  with open(downloaded_audio, 'rb') as fd:
197
- contents = fd.read()
198
  yield key, {
199
  "sentence": row["sentence"],
200
  "path": row["path"],
201
- "audio":{"path": row["path"], "bytes": contents}
202
  }
203
  key+=1
 
97
  downloaded_files = dl_manager.download(_FILES[self.config.name])
98
  path_to_audios = "/".join(["data/cleaned", self.config.name])
99
 
100
+ data_size = ['500', '1000', '2500', 'short', 'full']
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
101
 
102
+ splits = []
103
+ for size in data_size:
104
+ splits.append(
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
105
  datasets.SplitGenerator(
106
+ name=f"train_{size}",
107
  gen_kwargs={
108
+ "filepath": downloaded_files[f"train_{size}"],
109
  "dl_manager": dl_manager,
110
  },
111
+ )
112
+ )
113
+ splits.append(
114
  datasets.SplitGenerator(
115
+ name=f"val_{size}",
116
  gen_kwargs={
117
+ "filepath": downloaded_files[f"val_{size}"],
118
  "dl_manager": dl_manager,
119
  },
120
+ )
121
+ )
122
+ splits.append(
 
123
  datasets.SplitGenerator(
124
  name="test_common",
125
  gen_kwargs={
126
  "filepath": downloaded_files["test_common"],
127
  "dl_manager": dl_manager,
128
  },
129
+ )
130
+ )
131
+ return splits
132
 
133
 
134
  def _generate_examples(self, filepath, dl_manager):
 
138
  transcripts = []
139
  for index,row in data_df.iterrows():
140
  downloaded_audio = dl_manager.download(row["path"])
 
141
  with open(downloaded_audio, 'rb') as fd:
142
+ content = fd.read()
143
  yield key, {
144
  "sentence": row["sentence"],
145
  "path": row["path"],
146
+ "audio":{"path": row["path"], "bytes": content}
147
  }
148
  key+=1