asahi417 commited on
Commit
7f90e24
1 Parent(s): 734e52a
Files changed (2) hide show
  1. fetch_dataset_s2s.py +5 -0
  2. main_s2s.sh +88 -144
fetch_dataset_s2s.py CHANGED
@@ -43,6 +43,8 @@ hf_org = os.getenv("HF_ORG", "asahi417")
43
  hf_dataset = f"seamless-align-{direction}"
44
  skip_download = bool(int(os.getenv("SKIP_DOWNLOAD", 0)))
45
  sampling_rate = 16000 # seamless-align aligns audio in 16kHz
 
 
46
 
47
 
48
  def wget(url: str, output_file: Optional[str] = None):
@@ -131,6 +133,9 @@ def get_audio(dataframe: pd.DataFrame):
131
  wav = wav[floor(start / sampling_rate * sr):ceil(end / sampling_rate * sr)]
132
  print(f"wav shape (after truncate):{wav.shape}")
133
  wav = wav[:int(end/sampling_rate * sr) + sr]
 
 
 
134
  print(f"SAVING: {features[f'{side}.path']}")
135
  sf.write(features[f"{side}.path"], wav, sr)
136
  # if sr != sampling_rate:
 
43
  hf_dataset = f"seamless-align-{direction}"
44
  skip_download = bool(int(os.getenv("SKIP_DOWNLOAD", 0)))
45
  sampling_rate = 16000 # seamless-align aligns audio in 16kHz
46
+ max_seq_length = 1000000
47
+ min_seq_length = 50000
48
 
49
 
50
  def wget(url: str, output_file: Optional[str] = None):
 
133
  wav = wav[floor(start / sampling_rate * sr):ceil(end / sampling_rate * sr)]
134
  print(f"wav shape (after truncate):{wav.shape}")
135
  wav = wav[:int(end/sampling_rate * sr) + sr]
136
+ if len(wav) < min_seq_length or len(wav) > max_seq_length:
137
+ print(f"invalid wave length: {len(wav)}")
138
+ return None
139
  print(f"SAVING: {features[f'{side}.path']}")
140
  sf.write(features[f"{side}.path"], wav, sr)
141
  # if sr != sampling_rate:
main_s2s.sh CHANGED
@@ -18,16 +18,6 @@ do
18
  echo ${LINE_NO_START}
19
  python fetch_dataset_s2s.py
20
  done
21
- for i in $(seq 443 500);
22
- do
23
- export N_POOL=15
24
- export DATASET_ID=${i}
25
- export DIRECTION="enA-frA"
26
- export LINE_NO_START=$(((DATASET_ID-1) * 2500))
27
- export LINE_NO_END=$((DATASET_ID * 2500))
28
- echo ${LINE_NO_START}
29
- python fetch_dataset_s2s.py
30
- done
31
  for i in $(seq 519 550);
32
  do
33
  export N_POOL=15
@@ -90,25 +80,35 @@ do
90
  python tokenize_dataset_s2s.py
91
  done
92
  # speaker embedding
93
- for i in $(seq );
 
 
 
 
94
  do
95
  export DATASET_ID=${i}
96
  export DIRECTION="enA-frA"
97
  python attach_speaker_embedding_s2s.py
98
  done
99
- # tokenize
100
- for i in $(seq 106 425);
101
  do
102
- export N_POOL=15
103
  export DATASET_ID=${i}
104
  export DIRECTION="enA-frA"
105
- export LINE_NO_START=$(((DATASET_ID-1) * 2500))
106
- export LINE_NO_END=$((DATASET_ID * 2500))
107
- echo ${LINE_NO_START}
108
- python tokenize_dataset_s2s.py
109
  done
110
- # speaker embedding
111
- for i in $(seq 361 425);
 
 
 
 
 
 
 
 
 
 
 
112
  do
113
  export DATASET_ID=${i}
114
  export DIRECTION="enA-frA"
@@ -117,162 +117,167 @@ done
117
 
118
 
119
  ######################
120
- # enA-deA: 1_965_186 #
121
  ######################
122
  # test
123
  export DATASET_ID=test
124
- export DIRECTION="deA-enA"
125
  export LINE_NO_START=0
126
  export LINE_NO_END=10
127
  python fetch_dataset_s2s.py
128
  # main
129
- for i in $(seq 136 200);
 
 
 
 
 
 
 
130
  do
131
  export N_POOL=15
132
  export DATASET_ID=${i}
133
- export DIRECTION="deA-enA"
134
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
135
  export LINE_NO_END=$((DATASET_ID * 2500))
136
  echo ${LINE_NO_START}
137
  python fetch_dataset_s2s.py
138
  done
139
- for i in $(seq 201 394);
140
  do
141
  export N_POOL=15
142
  export DATASET_ID=${i}
143
- export DIRECTION="deA-enA"
144
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
145
  export LINE_NO_END=$((DATASET_ID * 2500))
146
  echo ${LINE_NO_START}
147
  python fetch_dataset_s2s.py
148
  done
149
- for i in $(seq 73 91);
150
  do
151
  export N_POOL=15
152
  export DATASET_ID=${i}
153
- export DIRECTION="deA-enA"
 
 
 
 
 
 
 
 
 
 
154
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
155
  export LINE_NO_END=$((DATASET_ID * 2500))
156
  echo ${LINE_NO_START}
157
  python fetch_dataset_s2s.py
158
  done
159
  # tokenize
160
- #for i in $(seq 73 91);
161
- #do
162
- # export N_POOL=15
163
- # export DATASET_ID=${i}
164
- # export DIRECTION="deA-enA"
165
- # export LINE_NO_START=$(((DATASET_ID-1) * 2500))
166
- # export LINE_NO_END=$((DATASET_ID * 2500))
167
- # echo ${LINE_NO_START}
168
- # python tokenize_dataset_s2s.py
169
- #done
170
- for i in $(seq 105 180);
171
  do
172
  export N_POOL=15
173
  export DATASET_ID=${i}
174
- export DIRECTION="deA-enA"
175
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
176
  export LINE_NO_END=$((DATASET_ID * 2500))
177
  echo ${LINE_NO_START}
178
  python tokenize_dataset_s2s.py
179
  done
180
  # speaker embedding
181
- for i in $(seq 28 104);
182
  do
183
  export DATASET_ID=${i}
184
- export DIRECTION="deA-enA"
185
  python attach_speaker_embedding_s2s.py
186
  done
187
- # speaker embedding
188
- for i in $(seq 370 394);
 
 
 
 
189
  do
190
  export DATASET_ID=${i}
191
- export DIRECTION="deA-enA"
192
  python attach_speaker_embedding_s2s.py
193
  done
 
 
 
 
194
  ######################
195
- # enA-esA: 2_658_022 #
196
  ######################
197
  # test
198
  export DATASET_ID=test
199
- export DIRECTION="enA-esA"
200
  export LINE_NO_START=0
201
  export LINE_NO_END=10
202
  python fetch_dataset_s2s.py
203
  # main
204
- for i in $(seq 194 220);
205
- do
206
- export N_POOL=15
207
- export DATASET_ID=${i}
208
- export DIRECTION="enA-esA"
209
- export LINE_NO_START=$(((DATASET_ID-1) * 2500))
210
- export LINE_NO_END=$((DATASET_ID * 2500))
211
- echo ${LINE_NO_START}
212
- python fetch_dataset_s2s.py
213
- done
214
- for i in $(seq 220 250);
215
  do
216
  export N_POOL=15
217
  export DATASET_ID=${i}
218
- export DIRECTION="enA-esA"
219
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
220
  export LINE_NO_END=$((DATASET_ID * 2500))
221
  echo ${LINE_NO_START}
222
  python fetch_dataset_s2s.py
223
  done
224
- for i in $(seq 333 420);
225
  do
226
  export N_POOL=15
227
  export DATASET_ID=${i}
228
- export DIRECTION="enA-esA"
229
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
230
  export LINE_NO_END=$((DATASET_ID * 2500))
231
  echo ${LINE_NO_START}
232
  python fetch_dataset_s2s.py
233
  done
234
- for i in $(seq 434 532);
 
235
  do
236
  export N_POOL=15
237
  export DATASET_ID=${i}
238
- export DIRECTION="enA-esA"
239
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
240
  export LINE_NO_END=$((DATASET_ID * 2500))
241
  echo ${LINE_NO_START}
242
- python fetch_dataset_s2s.py
243
  done
244
- # tokenize
245
- for i in $(seq 1 50);
246
  do
247
  export N_POOL=15
248
  export DATASET_ID=${i}
249
- export DIRECTION="enA-esA"
250
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
251
  export LINE_NO_END=$((DATASET_ID * 2500))
252
  echo ${LINE_NO_START}
253
  python tokenize_dataset_s2s.py
254
  done
255
  # speaker embedding
256
- for i in $(seq 251 280);
257
  do
258
  export DATASET_ID=${i}
259
- export DIRECTION="enA-esA"
260
  python attach_speaker_embedding_s2s.py
261
  done
262
-
263
- export SE_MODEL="w2vbert-600m" # running
264
- export SE_MODEL="xlsr-2b" # running
265
- export SE_MODEL="hubert-xl"
266
- export SE_MODEL="metavoice"
267
- for i in $(seq 26 125);
268
  do
269
  export DATASET_ID=${i}
270
- export DIRECTION="enA-esA"
271
  python attach_speaker_embedding_s2s.py
272
  done
273
 
274
 
275
 
 
 
 
276
  ####################
277
  # enA-koA: 511_358 #
278
  ####################
@@ -294,7 +299,7 @@ do
294
  python fetch_dataset_s2s.py
295
  done
296
  # tokenize
297
- for i in $(seq 76 98);
298
  do
299
  export N_POOL=15
300
  export DATASET_ID=${i}
@@ -306,31 +311,8 @@ do
306
  done
307
  # speaker embedding
308
  export SE_MODEL="metavoice"
309
- export SE_MODEL="w2vbert-600m" # running
310
- export SE_MODEL="xlsr-2b" # running
311
- export SE_MODEL="hubert-xl"
312
- for i in $(seq 1 90);
313
- do
314
- export DATASET_ID=${i}
315
- export DIRECTION="enA-koA"
316
- python attach_speaker_embedding_s2s.py
317
- done
318
-
319
- export SE_MODEL="metavoice"
320
- for i in 65 50;
321
- do
322
- export DATASET_ID=${i}
323
- export DIRECTION="enA-koA"
324
- python attach_speaker_embedding_s2s.py
325
- done
326
- for i in $(seq 90 98);
327
- do
328
- export DATASET_ID=${i}
329
- export DIRECTION="enA-koA"
330
- python attach_speaker_embedding_s2s.py
331
- done
332
-
333
- # todo
334
  export SE_MODEL="hubert-xl"
335
  for i in $(seq 1 100);
336
  do
@@ -339,20 +321,6 @@ do
339
  python attach_speaker_embedding_s2s.py
340
  done
341
 
342
- export SE_MODEL="w2vbert-600m"
343
- export DATASET_ID=34
344
- export DIRECTION="enA-koA"
345
- python attach_speaker_embedding_s2s.py
346
- export DATASET_ID=49
347
- export DIRECTION="enA-koA"
348
- python attach_speaker_embedding_s2s.py
349
- export SE_MODEL="xlsr-2b"
350
- export DATASET_ID=49
351
- export DIRECTION="enA-koA"
352
- python attach_speaker_embedding_s2s.py
353
-
354
-
355
-
356
  ######################
357
  # enA-zhA: 1_289_192 #
358
  ######################
@@ -387,8 +355,8 @@ done
387
  # speaker embedding
388
  export SE_MODEL="metavoice"
389
  export SE_MODEL="w2vbert-600m"
390
- export SE_MODEL="hubert-xl" # running
391
- export SE_MODEL="xlsr-2b" # running
392
  for i in $(seq 1 258);
393
  do
394
  export DATASET_ID=${i}
@@ -396,30 +364,6 @@ do
396
  python attach_speaker_embedding_s2s.py
397
  done
398
 
399
- for i in 162 163 164 165 175 83 84;
400
- do
401
- export SE_MODEL="xlsr-2b" # running
402
- export DIRECTION="enA-zhA"
403
- python attach_speaker_embedding_s2s.py
404
- done
405
-
406
- for i in 49 34;
407
- do
408
- export SE_MODEL="w2vbert-600m"
409
- export DATASET_ID=${i}
410
- export DIRECTION="enA-koA"
411
- python attach_speaker_embedding_s2s.py
412
- done
413
-
414
- for i in 34 81 49 50 21;
415
- do
416
- export SE_MODEL="xlsr-2b"
417
- export DATASET_ID=${i}
418
- export DIRECTION="enA-koA"
419
- python attach_speaker_embedding_s2s.py
420
- done
421
-
422
-
423
  ####################
424
  # enA-jaA: 718_606 #
425
  ####################
@@ -451,7 +395,7 @@ done
451
  export SE_MODEL="metavoice"
452
  export SE_MODEL="w2vbert-600m"
453
  export SE_MODEL="hubert-xl"
454
- export SE_MODEL="xlsr-2b" # running
455
  for i in $(seq 1 144);
456
  do
457
  export DATASET_ID=${i}
@@ -529,7 +473,7 @@ done
529
  export SE_MODEL="metavoice"
530
  export SE_MODEL="w2vbert-600m"
531
  export SE_MODEL="hubert-xl"
532
- export SE_MODEL="xlsr-2b" # running
533
  for i in $(seq 1 91);
534
  do
535
  export DATASET_ID=${i}
 
18
  echo ${LINE_NO_START}
19
  python fetch_dataset_s2s.py
20
  done
 
 
 
 
 
 
 
 
 
 
21
  for i in $(seq 519 550);
22
  do
23
  export N_POOL=15
 
80
  python tokenize_dataset_s2s.py
81
  done
82
  # speaker embedding
83
+ export SE_MODEL="metavoice"
84
+ export SE_MODEL="hubert-xl" # running
85
+ export SE_MODEL="xlsr-2b" # running
86
+ export SE_MODEL="w2vbert-600m" # running
87
+ for i in $(seq 1 140);
88
  do
89
  export DATASET_ID=${i}
90
  export DIRECTION="enA-frA"
91
  python attach_speaker_embedding_s2s.py
92
  done
93
+ for i in $(seq 200 240);
 
94
  do
 
95
  export DATASET_ID=${i}
96
  export DIRECTION="enA-frA"
97
+ python attach_speaker_embedding_s2s.py
 
 
 
98
  done
99
+ for i in $(seq 300 380);
100
+ do
101
+ export DATASET_ID=${i}
102
+ export DIRECTION="enA-frA"
103
+ python attach_speaker_embedding_s2s.py
104
+ done
105
+ for i in $(seq 400 460);
106
+ do
107
+ export DATASET_ID=${i}
108
+ export DIRECTION="enA-frA"
109
+ python attach_speaker_embedding_s2s.py
110
+ done
111
+ for i in $(seq 500 570);
112
  do
113
  export DATASET_ID=${i}
114
  export DIRECTION="enA-frA"
 
117
 
118
 
119
  ######################
120
+ # enA-esA: 2_658_022 #
121
  ######################
122
  # test
123
  export DATASET_ID=test
124
+ export DIRECTION="enA-esA"
125
  export LINE_NO_START=0
126
  export LINE_NO_END=10
127
  python fetch_dataset_s2s.py
128
  # main
129
+ export N_POOL=15
130
+ export DATASET_ID=54
131
+ export DIRECTION="enA-esA"
132
+ export LINE_NO_START=$(((DATASET_ID-1) * 2500))
133
+ export LINE_NO_END=$((DATASET_ID * 2500))
134
+ echo ${LINE_NO_START}
135
+ python fetch_dataset_s2s.py
136
+ for i in $(seq 210 219);
137
  do
138
  export N_POOL=15
139
  export DATASET_ID=${i}
140
+ export DIRECTION="enA-esA"
141
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
142
  export LINE_NO_END=$((DATASET_ID * 2500))
143
  echo ${LINE_NO_START}
144
  python fetch_dataset_s2s.py
145
  done
146
+ for i in $(seq 245 250);
147
  do
148
  export N_POOL=15
149
  export DATASET_ID=${i}
150
+ export DIRECTION="enA-esA"
151
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
152
  export LINE_NO_END=$((DATASET_ID * 2500))
153
  echo ${LINE_NO_START}
154
  python fetch_dataset_s2s.py
155
  done
156
+ for i in $(seq 345 390);
157
  do
158
  export N_POOL=15
159
  export DATASET_ID=${i}
160
+ export DIRECTION="enA-esA"
161
+ export LINE_NO_START=$(((DATASET_ID-1) * 2500))
162
+ export LINE_NO_END=$((DATASET_ID * 2500))
163
+ echo ${LINE_NO_START}
164
+ python fetch_dataset_s2s.py
165
+ done
166
+ for i in $(seq 390 420);
167
+ do
168
+ export N_POOL=15
169
+ export DATASET_ID=${i}
170
+ export DIRECTION="enA-esA"
171
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
172
  export LINE_NO_END=$((DATASET_ID * 2500))
173
  echo ${LINE_NO_START}
174
  python fetch_dataset_s2s.py
175
  done
176
  # tokenize
177
+ for i in $(seq 51 210);
 
 
 
 
 
 
 
 
 
 
178
  do
179
  export N_POOL=15
180
  export DATASET_ID=${i}
181
+ export DIRECTION="enA-esA"
182
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
183
  export LINE_NO_END=$((DATASET_ID * 2500))
184
  echo ${LINE_NO_START}
185
  python tokenize_dataset_s2s.py
186
  done
187
  # speaker embedding
188
+ for i in $(seq 251 280);
189
  do
190
  export DATASET_ID=${i}
191
+ export DIRECTION="enA-esA"
192
  python attach_speaker_embedding_s2s.py
193
  done
194
+
195
+ export SE_MODEL="w2vbert-600m" # running
196
+ export SE_MODEL="xlsr-2b" # running
197
+ export SE_MODEL="hubert-xl"
198
+ export SE_MODEL="metavoice"
199
+ for i in $(seq 26 125);
200
  do
201
  export DATASET_ID=${i}
202
+ export DIRECTION="enA-esA"
203
  python attach_speaker_embedding_s2s.py
204
  done
205
+
206
+
207
+
208
+
209
  ######################
210
+ # enA-deA: 1_965_186 #
211
  ######################
212
  # test
213
  export DATASET_ID=test
214
+ export DIRECTION="deA-enA"
215
  export LINE_NO_START=0
216
  export LINE_NO_END=10
217
  python fetch_dataset_s2s.py
218
  # main
219
+ for i in $(seq 201 394);
 
 
 
 
 
 
 
 
 
 
220
  do
221
  export N_POOL=15
222
  export DATASET_ID=${i}
223
+ export DIRECTION="deA-enA"
224
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
225
  export LINE_NO_END=$((DATASET_ID * 2500))
226
  echo ${LINE_NO_START}
227
  python fetch_dataset_s2s.py
228
  done
229
+ for i in $(seq 321 353);
230
  do
231
  export N_POOL=15
232
  export DATASET_ID=${i}
233
+ export DIRECTION="deA-enA"
234
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
235
  export LINE_NO_END=$((DATASET_ID * 2500))
236
  echo ${LINE_NO_START}
237
  python fetch_dataset_s2s.py
238
  done
239
+ # tokenize
240
+ for i in $(seq 195 200);
241
  do
242
  export N_POOL=15
243
  export DATASET_ID=${i}
244
+ export DIRECTION="deA-enA"
245
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
246
  export LINE_NO_END=$((DATASET_ID * 2500))
247
  echo ${LINE_NO_START}
248
+ python tokenize_dataset_s2s.py
249
  done
250
+ for i in $(seq 73 91);
 
251
  do
252
  export N_POOL=15
253
  export DATASET_ID=${i}
254
+ export DIRECTION="deA-enA"
255
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
256
  export LINE_NO_END=$((DATASET_ID * 2500))
257
  echo ${LINE_NO_START}
258
  python tokenize_dataset_s2s.py
259
  done
260
  # speaker embedding
261
+ for i in $(seq 28 104);
262
  do
263
  export DATASET_ID=${i}
264
+ export DIRECTION="deA-enA"
265
  python attach_speaker_embedding_s2s.py
266
  done
267
+ # speaker embedding
268
+ export SE_MODEL="w2vbert-600m"
269
+ for i in $(seq 1 320);
 
 
 
270
  do
271
  export DATASET_ID=${i}
272
+ export DIRECTION="deA-enA"
273
  python attach_speaker_embedding_s2s.py
274
  done
275
 
276
 
277
 
278
+
279
+
280
+
281
  ####################
282
  # enA-koA: 511_358 #
283
  ####################
 
299
  python fetch_dataset_s2s.py
300
  done
301
  # tokenize
302
+ for i in $(seq 1 100);
303
  do
304
  export N_POOL=15
305
  export DATASET_ID=${i}
 
311
  done
312
  # speaker embedding
313
  export SE_MODEL="metavoice"
314
+ export SE_MODEL="w2vbert-600m"
315
+ export SE_MODEL="xlsr-2b"
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
316
  export SE_MODEL="hubert-xl"
317
  for i in $(seq 1 100);
318
  do
 
321
  python attach_speaker_embedding_s2s.py
322
  done
323
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
324
  ######################
325
  # enA-zhA: 1_289_192 #
326
  ######################
 
355
  # speaker embedding
356
  export SE_MODEL="metavoice"
357
  export SE_MODEL="w2vbert-600m"
358
+ export SE_MODEL="hubert-xl"
359
+ export SE_MODEL="xlsr-2b"
360
  for i in $(seq 1 258);
361
  do
362
  export DATASET_ID=${i}
 
364
  python attach_speaker_embedding_s2s.py
365
  done
366
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
367
  ####################
368
  # enA-jaA: 718_606 #
369
  ####################
 
395
  export SE_MODEL="metavoice"
396
  export SE_MODEL="w2vbert-600m"
397
  export SE_MODEL="hubert-xl"
398
+ export SE_MODEL="xlsr-2b"
399
  for i in $(seq 1 144);
400
  do
401
  export DATASET_ID=${i}
 
473
  export SE_MODEL="metavoice"
474
  export SE_MODEL="w2vbert-600m"
475
  export SE_MODEL="hubert-xl"
476
+ export SE_MODEL="xlsr-2b"
477
  for i in $(seq 1 91);
478
  do
479
  export DATASET_ID=${i}