File size: 10,424 Bytes
70e3538
 
ddc421e
 
39fb289
 
eabf3d6
2dae5d5
 
 
70e3538
 
 
 
 
 
 
a5f8ab8
 
 
 
 
 
70e3538
 
d221d9f
 
 
 
 
 
 
 
 
b184add
 
 
70e3538
775b8cf
70e3538
 
 
 
 
 
 
775b8cf
70e3538
 
 
 
 
 
 
 
 
 
 
 
 
 
981a6f2
3524295
70e3538
e92b7b0
70e3538
 
 
 
 
 
a5f8ab8
e92b7b0
70e3538
 
 
 
 
 
a5f8ab8
70e3538
 
 
 
 
 
 
ae0e349
d59ca43
70e3538
d59ca43
 
ae0e349
 
d59ca43
5df4440
d59ca43
3524295
af5bf83
1125f7c
 
 
404c102
1125f7c
 
 
b184add
 
404c102
1125f7c
 
b184add
 
404c102
1125f7c
 
b184add
 
404c102
1125f7c
b184add
 
 
404c102
b184add
 
 
 
1125f7c
404c102
25e3cc0
404c102
d775ebe
 
404c102
d775ebe
404c102
 
d775ebe
 
404c102
d775ebe
404c102
 
d775ebe
 
404c102
25e3cc0
404c102
 
d775ebe
 
404c102
d775ebe
404c102
 
d775ebe
 
404c102
d775ebe
404c102
 
d775ebe
 
404c102
d775ebe
404c102
 
d775ebe
 
404c102
d775ebe
404c102
 
d775ebe
 
404c102
d775ebe
 
404c102
 
d194fbb
 
404c102
d775ebe
404c102
 
 
 
 
 
 
 
 
 
 
d775ebe
 
 
404c102
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d775ebe
25e3cc0
1125f7c
 
 
 
 
b184add
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
export CUDA_VISIBLE_DEVICES=0
export CUDA_VISIBLE_DEVICES=1
rm -rf download/audio
rm -rf download/feature
python -c 'n=41; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/feature/enA-jaA/*.json")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=41; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/audio/enA-jaA/enA/*")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=41; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/audio/enA-jaA/jaA/*")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=42; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/feature/enA-jaA/*.json")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=42; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/audio/enA-jaA/enA/*")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=42; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/audio/enA-jaA/jaA/*")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=51; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/feature/enA-jaA/*.json")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=51; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/audio/enA-jaA/enA/*")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=51; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/audio/enA-jaA/jaA/*")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'

python -c 'n=1; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/feature/enA-jaA/*.json")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=1; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/audio/enA-jaA/enA/*")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=1; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/audio/enA-jaA/jaA/*")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=2; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/feature/enA-jaA/*.json")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=2; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/audio/enA-jaA/enA/*")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=2; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/audio/enA-jaA/jaA/*")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=10; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/feature/enA-jaA/*.json")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=10; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/audio/enA-jaA/enA/*")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'
python -c 'n=10; import os; from glob import glob; tmp = [int(os.path.basename(i).split(".")[0]) for i in glob("download/audio/enA-jaA/jaA/*")]; print(len([x for x in tmp if (n-1) * 2500 <= x < n * 2500]))'

python -c 'file_name="tmp.mp3"; from datasets import Audio; a=Audio(); wav=a.decode_example({"path": file_name, "bytes": None}); print(wav)'
# test
export N_POOL=1
export DATASET_ID=1
export DIRECTION="enA-jaA"
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
export LINE_NO_END=$((DATASET_ID * 2500))
echo ${LINE_NO_START}
python download_audio.py

####################
# enA-jaA: 718_606 #
####################
export N_POOL=1
export DATASET_ID=1
export DIRECTION="enA-jaA"
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
export LINE_NO_END=$((DATASET_ID * 2500))
echo ${LINE_NO_START}
python download_audio.py

export N_POOL=10
export DATASET_ID=2
export DIRECTION="enA-jaA"
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
export LINE_NO_END=$((DATASET_ID * 2500))
echo ${LINE_NO_START}
python download_audio.py

export N_POOL=10
export DATASET_ID=10
export DIRECTION="enA-jaA"
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
export LINE_NO_END=$((DATASET_ID * 2500))
echo ${LINE_NO_START}
python download_audio.py



export N_POOL=1
export DATASET_ID=41
export DIRECTION="enA-jaA"
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
export LINE_NO_END=$((DATASET_ID * 2500))
echo ${LINE_NO_START}
python download_audio.py

export N_POOL=10
export DATASET_ID=42
export DIRECTION="enA-jaA"
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
export LINE_NO_END=$((DATASET_ID * 2500))
echo ${LINE_NO_START}
python download_audio.py

export N_POOL=10
export DATASET_ID=51
export DIRECTION="enA-jaA"
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
export LINE_NO_END=$((DATASET_ID * 2500))
echo ${LINE_NO_START}
python download_audio.py

for i in $(seq 51 60);
do
  export N_POOL=10
  export DATASET_ID=${i}
  export DIRECTION="enA-jaA"
  export LINE_NO_START=$(((DATASET_ID-1) * 2500))
  export LINE_NO_END=$((DATASET_ID * 2500))
  echo ${LINE_NO_START}
  python download_audio.py
done


######################
# enA-jpn: 1_468_292 #
######################
# DOWNLOAD AUDIO
export DIRECTION="enA-jpn"
export LINE_NO_START=0
export LINE_NO_END=50000
python download_audio.py

export DIRECTION="enA-jpn"
export LINE_NO_START=50000
export LINE_NO_END=100000
python download_audio.py

export DIRECTION="enA-jpn"
export LINE_NO_START=100000
export LINE_NO_END=150000
python download_audio.py

export DIRECTION="enA-jpn"
export LINE_NO_START=150000
export LINE_NO_END=300000
python download_audio.py

export DIRECTION="enA-jpn"
export LINE_NO_START=300000
export LINE_NO_END=360000
python download_audio.py


# FILTER AUDIO
export DIRECTION="enA-jpn"
export DIRECTION_SPEECH="enA"
export LINE_NO_START=0
export LINE_NO_END=25000
python filter_audio.py

export DIRECTION="enA-jpn"
export DIRECTION_SPEECH="enA"
export LINE_NO_START=25000
export LINE_NO_END=50000
python filter_audio.py

export DIRECTION="enA-jpn"
export DIRECTION_SPEECH="enA"
export LINE_NO_START=50000
export LINE_NO_END=75000
python filter_audio.py

export DIRECTION="enA-jpn"
export DIRECTION_SPEECH="enA"
export LINE_NO_START=75000
export LINE_NO_END=100000
python filter_audio.py

export DIRECTION="enA-jpn"
export DIRECTION_SPEECH="enA"
export LINE_NO_START=100000
export LINE_NO_END=125000
python filter_audio.py

export DIRECTION="enA-jpn"
export DIRECTION_SPEECH="enA"
export LINE_NO_START=125000
export LINE_NO_END=150000
python filter_audio.py

export DIRECTION="enA-jpn"
export DIRECTION_SPEECH="enA"
export LINE_NO_START=150000
export LINE_NO_END=175000
python filter_audio.py

export DIRECTION="enA-jpn"
export DIRECTION_SPEECH="enA"
export LINE_NO_START=175000
export LINE_NO_END=200000
python filter_audio.py


export DIRECTION="enA-jpn"
export DIRECTION_SPEECH="enA"
export LINE_NO_START=200000
export LINE_NO_END=225000
python filter_audio.py

#
#export LINE_NO_START=150000
#export LINE_NO_END=300000
#export DATASET_ID="0"
#python push_s2t_translation.py
#
#
#export LINE_NO_START=300000
#export LINE_NO_END=360000
#export DATASET_ID="0"
#python push_s2t_translation.py



# DOWNLOAD TEXT
git clone https://github.com/kpu/preprocess
cd preprocess
git checkout wet
git submodule update --init --recursive
mkdir build
cd build
cmake ..
make -j4
alias wet_lines="${PWD}/build/bin/wet_lines"
cd ../
wget https://dl.fbaipublicfiles.com/seamless/data/seamless.dataset.metadata.public.enA-jpn.withduration.tsv.gz
cp ../download_text.py ./
python download_text.py
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
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
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
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
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
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
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
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
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
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
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
cp ../format_text.py ./
python format_text.py
mv text.enA-jpn.json ../
cd ../


########
# NLLB #
########
# https://www.kecl.ntt.co.jp/icl/lirg/jparacrawl/
python -c "from datasets import load_dataset; load_dataset('allenai/nllb', 'eng_Latn-jpn_Jpan')"