asahi417 commited on
Commit
404c102
1 Parent(s): d194fbb
Files changed (2) hide show
  1. filter_audio_s2t.py → filter_audio.py +2 -6
  2. main.sh +72 -65
filter_audio_s2t.py → filter_audio.py RENAMED
@@ -9,9 +9,8 @@ import soundfile as sf
9
  from datasets import Audio
10
 
11
  # dataset config
 
12
  direction_speech = os.getenv("DIRECTION_SPEECH", "enA")
13
- direction_text = os.getenv("DIRECTION_TEXT", "jpn")
14
- direction = f"{direction_speech}-{direction_text}"
15
  cache_dir_audio = p_join("download", "audio", direction)
16
  cache_dir_feature = p_join("download", "feature", direction)
17
  cache_dir_audio_fixed = p_join("download", "audio_fixed", direction, direction_speech)
@@ -33,13 +32,10 @@ files = {
33
  }
34
  # feature files
35
  files_list = [k for k in files.keys() if line_no_start <= k <= line_no_end]
36
- with open(f"text.{direction}.json") as f:
37
- line2text = {int(k): v for k, v in json.load(f).items()}
38
- text_list = [k for k in line2text.keys() if line_no_start <= k <= line_no_end]
39
  fixed_audio_list = [int(os.path.basename(i).replace(".mp3", "")) for i in glob(p_join(cache_dir_audio_fixed, "*"))]
40
  # remove broken audio files
41
  audio_loader = Audio()
42
- index_list = [i for i in list(range(line_no_start, line_no_end)) if i in files_list and i in text_list and i not in fixed_audio_list]
43
  print(f"filtering {len(index_list)} files....")
44
  for i in tqdm(index_list):
45
  features = loader(files[i])
 
9
  from datasets import Audio
10
 
11
  # dataset config
12
+ direction = os.getenv("DIRECTION", "enA-jpn")
13
  direction_speech = os.getenv("DIRECTION_SPEECH", "enA")
 
 
14
  cache_dir_audio = p_join("download", "audio", direction)
15
  cache_dir_feature = p_join("download", "feature", direction)
16
  cache_dir_audio_fixed = p_join("download", "audio_fixed", direction, direction_speech)
 
32
  }
33
  # feature files
34
  files_list = [k for k in files.keys() if line_no_start <= k <= line_no_end]
 
 
 
35
  fixed_audio_list = [int(os.path.basename(i).replace(".mp3", "")) for i in glob(p_join(cache_dir_audio_fixed, "*"))]
36
  # remove broken audio files
37
  audio_loader = Audio()
38
+ index_list = [i for i in list(range(line_no_start, line_no_end)) if i in files_list and i not in fixed_audio_list]
39
  print(f"filtering {len(index_list)} files....")
40
  for i in tqdm(index_list):
41
  features = loader(files[i])
main.sh CHANGED
@@ -82,125 +82,132 @@ python push_s2s_translation.py
82
  ######################
83
  # enA-jpn: 1_468_292 #
84
  ######################
85
- # AUDIO
86
  export DIRECTION="enA-jpn"
87
-
88
  export LINE_NO_START=0
89
  export LINE_NO_END=50000
90
  python download_audio.py
91
 
 
92
  export LINE_NO_START=50000
93
  export LINE_NO_END=100000
94
  python download_audio.py
95
 
 
96
  export LINE_NO_START=100000
97
  export LINE_NO_END=150000
98
  python download_audio.py
99
 
 
100
  export LINE_NO_START=150000
101
  export LINE_NO_END=300000
102
  python download_audio.py
103
 
 
104
  export LINE_NO_START=300000
105
  export LINE_NO_END=360000
106
  python download_audio.py
107
 
108
- # TEXT
109
- git clone https://github.com/kpu/preprocess
110
- cd preprocess
111
- git checkout wet
112
- git submodule update --init --recursive
113
- mkdir build
114
- cd build
115
- cmake ..
116
- make -j4
117
- alias wet_lines="${PWD}/build/bin/wet_lines"
118
- cd ../
119
- wget https://dl.fbaipublicfiles.com/seamless/data/seamless.dataset.metadata.public.enA-jpn.withduration.tsv.gz
120
- cp ../download_text.py ./
121
- python download_text.py
122
- cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_1.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_1.tsv
123
- cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_2.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_2.tsv
124
- cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_3.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_3.tsv
125
- cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_4.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_4.tsv
126
- cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_5.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_5.tsv
127
- cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_6.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_6.tsv
128
- cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_7.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_7.tsv
129
- cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_8.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_8.tsv
130
- cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_9.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_9.tsv
131
- cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_10.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_10.tsv
132
- cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_11.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_11.tsv
133
- cp ../format_text.py ./
134
- python format_text.py
135
- mv text.enA-jpn.json ../
136
- cd ../
137
 
 
138
  export DIRECTION="enA-jpn"
139
-
140
- export LINE_NO_START=50
141
- export LINE_NO_END=100
142
-
143
-
144
  export LINE_NO_START=0
145
  export LINE_NO_END=25000
146
- export DATASET_ID="1"
147
- python filter_audio_s2t.py
148
 
 
 
149
  export LINE_NO_START=25000
150
  export LINE_NO_END=50000
151
- export DATASET_ID="2"
152
- python filter_audio_s2t.py
153
 
 
 
154
  export LINE_NO_START=50000
155
  export LINE_NO_END=75000
156
- export DATASET_ID="3"
157
- python filter_audio_s2t.py
158
 
 
 
159
  export LINE_NO_START=75000
160
  export LINE_NO_END=100000
161
- export DATASET_ID="4"
162
- python filter_audio_s2t.py
163
 
 
 
164
  export LINE_NO_START=100000
165
  export LINE_NO_END=125000
166
- export DATASET_ID="5"
167
- python filter_audio_s2t.py
168
 
 
 
169
  export LINE_NO_START=125000
170
  export LINE_NO_END=150000
171
- export DATASET_ID="6"
172
- python filter_audio_s2t.py
173
 
 
 
174
  export LINE_NO_START=150000
175
  export LINE_NO_END=175000
176
- export DATASET_ID="7"
177
- python filter_audio_s2t.py
178
 
 
 
179
  export LINE_NO_START=175000
180
  export LINE_NO_END=200000
181
- export DATASET_ID="8"
182
- python filter_audio_s2t.py
183
-
184
-
185
 
186
 
 
 
187
  export LINE_NO_START=200000
188
  export LINE_NO_END=225000
189
- export DATASET_ID="9"
190
- python filter_audio_s2t.py
191
 
 
 
 
 
 
 
 
 
 
 
 
192
 
193
- export LINE_NO_START=150000
194
- export LINE_NO_END=300000
195
- export DATASET_ID="0"
196
- python push_s2t_translation.py
197
 
198
 
199
- export LINE_NO_START=300000
200
- export LINE_NO_END=360000
201
- export DATASET_ID="0"
202
- python push_s2t_translation.py
203
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
204
 
205
 
206
  ########
 
82
  ######################
83
  # enA-jpn: 1_468_292 #
84
  ######################
85
+ # DOWNLOAD AUDIO
86
  export DIRECTION="enA-jpn"
 
87
  export LINE_NO_START=0
88
  export LINE_NO_END=50000
89
  python download_audio.py
90
 
91
+ export DIRECTION="enA-jpn"
92
  export LINE_NO_START=50000
93
  export LINE_NO_END=100000
94
  python download_audio.py
95
 
96
+ export DIRECTION="enA-jpn"
97
  export LINE_NO_START=100000
98
  export LINE_NO_END=150000
99
  python download_audio.py
100
 
101
+ export DIRECTION="enA-jpn"
102
  export LINE_NO_START=150000
103
  export LINE_NO_END=300000
104
  python download_audio.py
105
 
106
+ export DIRECTION="enA-jpn"
107
  export LINE_NO_START=300000
108
  export LINE_NO_END=360000
109
  python download_audio.py
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
 
112
+ # FILTER AUDIO
113
  export DIRECTION="enA-jpn"
114
+ export DIRECTION_SPEECH="enA"
 
 
 
 
115
  export LINE_NO_START=0
116
  export LINE_NO_END=25000
117
+ python filter_audio.py
 
118
 
119
+ export DIRECTION="enA-jpn"
120
+ export DIRECTION_SPEECH="enA"
121
  export LINE_NO_START=25000
122
  export LINE_NO_END=50000
123
+ python filter_audio.py
 
124
 
125
+ export DIRECTION="enA-jpn"
126
+ export DIRECTION_SPEECH="enA"
127
  export LINE_NO_START=50000
128
  export LINE_NO_END=75000
129
+ python filter_audio.py
 
130
 
131
+ export DIRECTION="enA-jpn"
132
+ export DIRECTION_SPEECH="enA"
133
  export LINE_NO_START=75000
134
  export LINE_NO_END=100000
135
+ python filter_audio.py
 
136
 
137
+ export DIRECTION="enA-jpn"
138
+ export DIRECTION_SPEECH="enA"
139
  export LINE_NO_START=100000
140
  export LINE_NO_END=125000
141
+ python filter_audio.py
 
142
 
143
+ export DIRECTION="enA-jpn"
144
+ export DIRECTION_SPEECH="enA"
145
  export LINE_NO_START=125000
146
  export LINE_NO_END=150000
147
+ python filter_audio.py
 
148
 
149
+ export DIRECTION="enA-jpn"
150
+ export DIRECTION_SPEECH="enA"
151
  export LINE_NO_START=150000
152
  export LINE_NO_END=175000
153
+ python filter_audio.py
 
154
 
155
+ export DIRECTION="enA-jpn"
156
+ export DIRECTION_SPEECH="enA"
157
  export LINE_NO_START=175000
158
  export LINE_NO_END=200000
159
+ python filter_audio.py
 
 
 
160
 
161
 
162
+ export DIRECTION="enA-jpn"
163
+ export DIRECTION_SPEECH="enA"
164
  export LINE_NO_START=200000
165
  export LINE_NO_END=225000
166
+ python filter_audio.py
 
167
 
168
+ #
169
+ #export LINE_NO_START=150000
170
+ #export LINE_NO_END=300000
171
+ #export DATASET_ID="0"
172
+ #python push_s2t_translation.py
173
+ #
174
+ #
175
+ #export LINE_NO_START=300000
176
+ #export LINE_NO_END=360000
177
+ #export DATASET_ID="0"
178
+ #python push_s2t_translation.py
179
 
 
 
 
 
180
 
181
 
182
+ # DOWNLOAD TEXT
183
+ git clone https://github.com/kpu/preprocess
184
+ cd preprocess
185
+ git checkout wet
186
+ git submodule update --init --recursive
187
+ mkdir build
188
+ cd build
189
+ cmake ..
190
+ make -j4
191
+ alias wet_lines="${PWD}/build/bin/wet_lines"
192
+ cd ../
193
+ wget https://dl.fbaipublicfiles.com/seamless/data/seamless.dataset.metadata.public.enA-jpn.withduration.tsv.gz
194
+ cp ../download_text.py ./
195
+ python download_text.py
196
+ cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_1.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_1.tsv
197
+ cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_2.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_2.tsv
198
+ cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_3.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_3.tsv
199
+ cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_4.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_4.tsv
200
+ cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_5.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_5.tsv
201
+ cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_6.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_6.tsv
202
+ cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_7.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_7.tsv
203
+ cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_8.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_8.tsv
204
+ cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_9.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_9.tsv
205
+ cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_10.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_10.tsv
206
+ cat seamless.dataset.metadata.public.enA-jpn.withduration.reordered.batch_11.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee seamless.dataset.metadata.public.jpn.batch_11.tsv
207
+ cp ../format_text.py ./
208
+ python format_text.py
209
+ mv text.enA-jpn.json ../
210
+ cd ../
211
 
212
 
213
  ########