init
Browse files- download_s2t_metadata.py +1 -1
- main_s2s.sh +226 -73
- main_s2t.sh +18 -1
- speaker_embedding_clap.py +35 -0
download_s2t_metadata.py
CHANGED
@@ -19,7 +19,7 @@ filename = os.path.basename(url)
|
|
19 |
subprocess.run(["wget", url, "-O", filename])
|
20 |
df = pd.read_csv(filename, sep='\t', header=None, dtype=str)
|
21 |
df.columns = ["cc_warc", "cc_sha", "cc_document_url", "cc_lineno", "paragraph_digest", "sentence_digest", "text_lid_score", "laser_score", "direction", "side", "line_no"]
|
22 |
-
df = df[df.side ==
|
23 |
df["cc_lineno"] = df["cc_lineno"].astype(int)
|
24 |
df.sort_values(by=["cc_warc", "cc_sha", "cc_document_url", "cc_lineno"], inplace=True)
|
25 |
batch_size = int(len(df)/chunk_size)
|
|
|
19 |
subprocess.run(["wget", url, "-O", filename])
|
20 |
df = pd.read_csv(filename, sep='\t', header=None, dtype=str)
|
21 |
df.columns = ["cc_warc", "cc_sha", "cc_document_url", "cc_lineno", "paragraph_digest", "sentence_digest", "text_lid_score", "laser_score", "direction", "side", "line_no"]
|
22 |
+
df = df[df.side == direction_text]
|
23 |
df["cc_lineno"] = df["cc_lineno"].astype(int)
|
24 |
df.sort_values(by=["cc_warc", "cc_sha", "cc_document_url", "cc_lineno"], inplace=True)
|
25 |
batch_size = int(len(df)/chunk_size)
|
main_s2s.sh
CHANGED
@@ -1,234 +1,387 @@
|
|
1 |
####################
|
2 |
-
# enA-
|
3 |
####################
|
4 |
# test
|
5 |
export DATASET_ID=test
|
6 |
-
export DIRECTION="enA-
|
7 |
export LINE_NO_START=0
|
8 |
export LINE_NO_END=10
|
9 |
python fetch_dataset_s2s.py
|
10 |
# main
|
11 |
-
for i in $(seq 1
|
12 |
do
|
13 |
export N_POOL=15
|
14 |
export DATASET_ID=${i}
|
15 |
-
export DIRECTION="enA-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
16 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
17 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
18 |
echo ${LINE_NO_START}
|
19 |
python fetch_dataset_s2s.py
|
20 |
done
|
21 |
# tokenize
|
22 |
-
for i in $(seq 1
|
23 |
do
|
|
|
24 |
export DATASET_ID=${i}
|
25 |
-
export DIRECTION="enA-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
26 |
python tokenize_dataset_s2s.py
|
27 |
done
|
28 |
# speaker embedding
|
29 |
-
for i in $(seq 1
|
30 |
do
|
31 |
export DATASET_ID=${i}
|
32 |
-
export DIRECTION="enA-
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
python attach_speaker_embedding_s2s.py
|
34 |
done
|
35 |
|
36 |
-
|
37 |
-
# enA-
|
38 |
-
|
39 |
# test
|
40 |
export DATASET_ID=test
|
41 |
-
export DIRECTION="enA-
|
42 |
export LINE_NO_START=0
|
43 |
export LINE_NO_END=10
|
44 |
python fetch_dataset_s2s.py
|
45 |
# main
|
46 |
-
for i in $(seq 1
|
47 |
do
|
48 |
export N_POOL=15
|
49 |
export DATASET_ID=${i}
|
50 |
-
export DIRECTION="enA-
|
51 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
52 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
53 |
echo ${LINE_NO_START}
|
54 |
python fetch_dataset_s2s.py
|
55 |
done
|
56 |
# tokenize
|
57 |
-
for i in $(seq
|
58 |
do
|
|
|
59 |
export DATASET_ID=${i}
|
60 |
-
export DIRECTION="enA-
|
|
|
|
|
|
|
61 |
python tokenize_dataset_s2s.py
|
62 |
done
|
63 |
# speaker embedding
|
64 |
-
for i in $(seq
|
65 |
do
|
66 |
export DATASET_ID=${i}
|
67 |
-
export DIRECTION="enA-
|
68 |
python attach_speaker_embedding_s2s.py
|
69 |
done
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
####################
|
74 |
# test
|
75 |
export DATASET_ID=test
|
76 |
-
export DIRECTION="enA-
|
77 |
export LINE_NO_START=0
|
78 |
export LINE_NO_END=10
|
79 |
python fetch_dataset_s2s.py
|
80 |
# main
|
81 |
-
for i in $(seq 1
|
82 |
do
|
83 |
export N_POOL=15
|
84 |
export DATASET_ID=${i}
|
85 |
-
export DIRECTION="enA-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
86 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
87 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
88 |
echo ${LINE_NO_START}
|
89 |
python fetch_dataset_s2s.py
|
90 |
done
|
91 |
# tokenize
|
92 |
-
for i in $(seq
|
93 |
do
|
|
|
94 |
export DATASET_ID=${i}
|
95 |
-
export DIRECTION="enA-
|
|
|
|
|
|
|
96 |
python tokenize_dataset_s2s.py
|
97 |
done
|
98 |
-
for i in
|
99 |
do
|
|
|
100 |
export DATASET_ID=${i}
|
101 |
-
export DIRECTION="enA-
|
|
|
|
|
|
|
102 |
python tokenize_dataset_s2s.py
|
103 |
done
|
104 |
# speaker embedding
|
105 |
-
for i in $(seq 1
|
106 |
do
|
107 |
export DATASET_ID=${i}
|
108 |
-
export DIRECTION="enA-
|
109 |
python attach_speaker_embedding_s2s.py
|
110 |
done
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
# test
|
116 |
export DATASET_ID=test
|
117 |
-
export DIRECTION="enA
|
118 |
export LINE_NO_START=0
|
119 |
export LINE_NO_END=10
|
120 |
python fetch_dataset_s2s.py
|
121 |
# main
|
122 |
-
for i in $(seq 1
|
123 |
do
|
124 |
export N_POOL=15
|
125 |
export DATASET_ID=${i}
|
126 |
-
export DIRECTION="enA
|
127 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
128 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
129 |
echo ${LINE_NO_START}
|
130 |
python fetch_dataset_s2s.py
|
131 |
done
|
132 |
-
for i in $(seq
|
133 |
do
|
134 |
export N_POOL=15
|
135 |
export DATASET_ID=${i}
|
136 |
-
export DIRECTION="enA
|
137 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
138 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
139 |
echo ${LINE_NO_START}
|
140 |
python fetch_dataset_s2s.py
|
141 |
done
|
142 |
-
|
143 |
-
|
144 |
-
# enA-zhA: 1_289_192 #
|
145 |
-
######################
|
146 |
-
# test
|
147 |
-
export DATASET_ID=test
|
148 |
-
export DIRECTION="enA-zhA"
|
149 |
-
export LINE_NO_START=0
|
150 |
-
export LINE_NO_END=10
|
151 |
-
python fetch_dataset_s2s.py
|
152 |
-
# main
|
153 |
-
for i in $(seq 1 258);
|
154 |
do
|
155 |
export N_POOL=15
|
156 |
export DATASET_ID=${i}
|
157 |
-
export DIRECTION="enA
|
158 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
159 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
160 |
echo ${LINE_NO_START}
|
161 |
-
python
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
162 |
done
|
163 |
-
|
164 |
######################
|
165 |
-
# enA-
|
166 |
######################
|
167 |
# test
|
168 |
export DATASET_ID=test
|
169 |
-
export DIRECTION="enA-
|
170 |
export LINE_NO_START=0
|
171 |
export LINE_NO_END=10
|
172 |
python fetch_dataset_s2s.py
|
173 |
# main
|
174 |
-
for i in $(seq 1
|
175 |
do
|
176 |
export N_POOL=15
|
177 |
export DATASET_ID=${i}
|
178 |
-
export DIRECTION="enA-
|
179 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
180 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
181 |
echo ${LINE_NO_START}
|
182 |
python fetch_dataset_s2s.py
|
183 |
done
|
184 |
-
for i in $(seq
|
185 |
do
|
186 |
export N_POOL=15
|
187 |
export DATASET_ID=${i}
|
188 |
-
export DIRECTION="enA-
|
189 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
190 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
191 |
echo ${LINE_NO_START}
|
192 |
python fetch_dataset_s2s.py
|
193 |
done
|
194 |
|
195 |
-
|
196 |
-
|
197 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
198 |
# test
|
199 |
export DATASET_ID=test
|
200 |
-
export DIRECTION="enA-
|
201 |
export LINE_NO_START=0
|
202 |
export LINE_NO_END=10
|
203 |
python fetch_dataset_s2s.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
204 |
|
205 |
-
|
206 |
-
# enA-
|
207 |
-
|
208 |
# test
|
209 |
export DATASET_ID=test
|
210 |
-
export DIRECTION="
|
211 |
export LINE_NO_START=0
|
212 |
export LINE_NO_END=10
|
213 |
python fetch_dataset_s2s.py
|
214 |
# main
|
215 |
-
for i in $(seq 1
|
216 |
do
|
217 |
export N_POOL=15
|
218 |
export DATASET_ID=${i}
|
219 |
-
export DIRECTION="
|
220 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
221 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
222 |
echo ${LINE_NO_START}
|
223 |
python fetch_dataset_s2s.py
|
224 |
done
|
225 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
226 |
do
|
227 |
export N_POOL=15
|
228 |
export DATASET_ID=${i}
|
229 |
-
export DIRECTION="
|
230 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
231 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
232 |
echo ${LINE_NO_START}
|
233 |
python fetch_dataset_s2s.py
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
234 |
done
|
|
|
1 |
####################
|
2 |
+
# enA-koA: 511_358 #
|
3 |
####################
|
4 |
# test
|
5 |
export DATASET_ID=test
|
6 |
+
export DIRECTION="enA-koA"
|
7 |
export LINE_NO_START=0
|
8 |
export LINE_NO_END=10
|
9 |
python fetch_dataset_s2s.py
|
10 |
# main
|
11 |
+
for i in $(seq 1 50);
|
12 |
do
|
13 |
export N_POOL=15
|
14 |
export DATASET_ID=${i}
|
15 |
+
export DIRECTION="enA-koA"
|
16 |
+
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
17 |
+
export LINE_NO_END=$((DATASET_ID * 2500))
|
18 |
+
echo ${LINE_NO_START}
|
19 |
+
python fetch_dataset_s2s.py
|
20 |
+
done
|
21 |
+
for i in $(seq 51 100);
|
22 |
+
do
|
23 |
+
export N_POOL=15
|
24 |
+
export DATASET_ID=${i}
|
25 |
+
export DIRECTION="enA-koA"
|
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 |
# tokenize
|
32 |
+
for i in $(seq 1 20);
|
33 |
do
|
34 |
+
export N_POOL=15
|
35 |
export DATASET_ID=${i}
|
36 |
+
export DIRECTION="enA-koA"
|
37 |
+
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
38 |
+
export LINE_NO_END=$((DATASET_ID * 2500))
|
39 |
+
echo ${LINE_NO_START}
|
40 |
+
python tokenize_dataset_s2s.py
|
41 |
+
done
|
42 |
+
for i in $(seq 51 64);
|
43 |
+
do
|
44 |
+
export N_POOL=15
|
45 |
+
export DATASET_ID=${i}
|
46 |
+
export DIRECTION="enA-koA"
|
47 |
+
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
48 |
+
export LINE_NO_END=$((DATASET_ID * 2500))
|
49 |
+
echo ${LINE_NO_START}
|
50 |
python tokenize_dataset_s2s.py
|
51 |
done
|
52 |
# speaker embedding
|
53 |
+
for i in $(seq 1 20);
|
54 |
do
|
55 |
export DATASET_ID=${i}
|
56 |
+
export DIRECTION="enA-koA"
|
57 |
+
python attach_speaker_embedding_s2s.py
|
58 |
+
done
|
59 |
+
for i in $(seq 51 64);
|
60 |
+
do
|
61 |
+
export DATASET_ID=${i}
|
62 |
+
export DIRECTION="enA-koA"
|
63 |
python attach_speaker_embedding_s2s.py
|
64 |
done
|
65 |
|
66 |
+
######################
|
67 |
+
# enA-zhA: 1_289_192 #
|
68 |
+
######################
|
69 |
# test
|
70 |
export DATASET_ID=test
|
71 |
+
export DIRECTION="enA-zhA"
|
72 |
export LINE_NO_START=0
|
73 |
export LINE_NO_END=10
|
74 |
python fetch_dataset_s2s.py
|
75 |
# main
|
76 |
+
for i in $(seq 1 258);
|
77 |
do
|
78 |
export N_POOL=15
|
79 |
export DATASET_ID=${i}
|
80 |
+
export DIRECTION="enA-zhA"
|
81 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
82 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
83 |
echo ${LINE_NO_START}
|
84 |
python fetch_dataset_s2s.py
|
85 |
done
|
86 |
# tokenize
|
87 |
+
for i in $(seq 81 100);
|
88 |
do
|
89 |
+
export N_POOL=15
|
90 |
export DATASET_ID=${i}
|
91 |
+
export DIRECTION="enA-zhA"
|
92 |
+
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
93 |
+
export LINE_NO_END=$((DATASET_ID * 2500))
|
94 |
+
echo ${LINE_NO_START}
|
95 |
python tokenize_dataset_s2s.py
|
96 |
done
|
97 |
# speaker embedding
|
98 |
+
for i in $(seq 81 100);
|
99 |
do
|
100 |
export DATASET_ID=${i}
|
101 |
+
export DIRECTION="enA-zhA"
|
102 |
python attach_speaker_embedding_s2s.py
|
103 |
done
|
104 |
+
######################
|
105 |
+
# enA-frA: 3_054_258 #
|
106 |
+
######################
|
|
|
107 |
# test
|
108 |
export DATASET_ID=test
|
109 |
+
export DIRECTION="enA-frA"
|
110 |
export LINE_NO_START=0
|
111 |
export LINE_NO_END=10
|
112 |
python fetch_dataset_s2s.py
|
113 |
# main
|
114 |
+
for i in $(seq 1 300);
|
115 |
do
|
116 |
export N_POOL=15
|
117 |
export DATASET_ID=${i}
|
118 |
+
export DIRECTION="enA-frA"
|
119 |
+
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
120 |
+
export LINE_NO_END=$((DATASET_ID * 2500))
|
121 |
+
echo ${LINE_NO_START}
|
122 |
+
python fetch_dataset_s2s.py
|
123 |
+
done
|
124 |
+
for i in $(seq 300 600);
|
125 |
+
do
|
126 |
+
export N_POOL=15
|
127 |
+
export DATASET_ID=${i}
|
128 |
+
export DIRECTION="enA-frA"
|
129 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
130 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
131 |
echo ${LINE_NO_START}
|
132 |
python fetch_dataset_s2s.py
|
133 |
done
|
134 |
# tokenize
|
135 |
+
for i in $(seq 1 30);
|
136 |
do
|
137 |
+
export N_POOL=15
|
138 |
export DATASET_ID=${i}
|
139 |
+
export DIRECTION="enA-frA"
|
140 |
+
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
141 |
+
export LINE_NO_END=$((DATASET_ID * 2500))
|
142 |
+
echo ${LINE_NO_START}
|
143 |
python tokenize_dataset_s2s.py
|
144 |
done
|
145 |
+
for i in $(seq 300 330);
|
146 |
do
|
147 |
+
export N_POOL=15
|
148 |
export DATASET_ID=${i}
|
149 |
+
export DIRECTION="enA-frA"
|
150 |
+
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
151 |
+
export LINE_NO_END=$((DATASET_ID * 2500))
|
152 |
+
echo ${LINE_NO_START}
|
153 |
python tokenize_dataset_s2s.py
|
154 |
done
|
155 |
# speaker embedding
|
156 |
+
for i in $(seq 1 30);
|
157 |
do
|
158 |
export DATASET_ID=${i}
|
159 |
+
export DIRECTION="enA-frA"
|
160 |
python attach_speaker_embedding_s2s.py
|
161 |
done
|
162 |
+
# speaker embedding
|
163 |
+
for i in $(seq 300 330);
|
164 |
+
do
|
165 |
+
export DATASET_ID=${i}
|
166 |
+
export DIRECTION="enA-frA"
|
167 |
+
python attach_speaker_embedding_s2s.py
|
168 |
+
done
|
169 |
+
######################
|
170 |
+
# enA-deA: 1_965_186 #
|
171 |
+
######################
|
172 |
# test
|
173 |
export DATASET_ID=test
|
174 |
+
export DIRECTION="deA-enA"
|
175 |
export LINE_NO_START=0
|
176 |
export LINE_NO_END=10
|
177 |
python fetch_dataset_s2s.py
|
178 |
# main
|
179 |
+
for i in $(seq 1 200);
|
180 |
do
|
181 |
export N_POOL=15
|
182 |
export DATASET_ID=${i}
|
183 |
+
export DIRECTION="deA-enA"
|
184 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
185 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
186 |
echo ${LINE_NO_START}
|
187 |
python fetch_dataset_s2s.py
|
188 |
done
|
189 |
+
for i in $(seq 201 394);
|
190 |
do
|
191 |
export N_POOL=15
|
192 |
export DATASET_ID=${i}
|
193 |
+
export DIRECTION="deA-enA"
|
194 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
195 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
196 |
echo ${LINE_NO_START}
|
197 |
python fetch_dataset_s2s.py
|
198 |
done
|
199 |
+
# tokenize
|
200 |
+
for i in $(seq 1 20);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
201 |
do
|
202 |
export N_POOL=15
|
203 |
export DATASET_ID=${i}
|
204 |
+
export DIRECTION="deA-enA"
|
205 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
206 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
207 |
echo ${LINE_NO_START}
|
208 |
+
python tokenize_dataset_s2s.py
|
209 |
+
done
|
210 |
+
for i in $(seq 200 240);
|
211 |
+
do
|
212 |
+
export N_POOL=15
|
213 |
+
export DATASET_ID=${i}
|
214 |
+
export DIRECTION="deA-enA"
|
215 |
+
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
216 |
+
export LINE_NO_END=$((DATASET_ID * 2500))
|
217 |
+
echo ${LINE_NO_START}
|
218 |
+
python tokenize_dataset_s2s.py
|
219 |
+
done
|
220 |
+
# speaker embedding
|
221 |
+
for i in $(seq 1 20);
|
222 |
+
do
|
223 |
+
export DATASET_ID=${i}
|
224 |
+
export DIRECTION="deA-enA"
|
225 |
+
python attach_speaker_embedding_s2s.py
|
226 |
+
done
|
227 |
+
# speaker embedding
|
228 |
+
for i in $(seq 200 240);
|
229 |
+
do
|
230 |
+
export DATASET_ID=${i}
|
231 |
+
export DIRECTION="deA-enA"
|
232 |
+
python attach_speaker_embedding_s2s.py
|
233 |
done
|
|
|
234 |
######################
|
235 |
+
# enA-esA: 2_658_022 #
|
236 |
######################
|
237 |
# test
|
238 |
export DATASET_ID=test
|
239 |
+
export DIRECTION="enA-esA"
|
240 |
export LINE_NO_START=0
|
241 |
export LINE_NO_END=10
|
242 |
python fetch_dataset_s2s.py
|
243 |
# main
|
244 |
+
for i in $(seq 1 250);
|
245 |
do
|
246 |
export N_POOL=15
|
247 |
export DATASET_ID=${i}
|
248 |
+
export DIRECTION="enA-esA"
|
249 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
250 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
251 |
echo ${LINE_NO_START}
|
252 |
python fetch_dataset_s2s.py
|
253 |
done
|
254 |
+
for i in $(seq 251 532);
|
255 |
do
|
256 |
export N_POOL=15
|
257 |
export DATASET_ID=${i}
|
258 |
+
export DIRECTION="enA-esA"
|
259 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
260 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
261 |
echo ${LINE_NO_START}
|
262 |
python fetch_dataset_s2s.py
|
263 |
done
|
264 |
|
265 |
+
# tokenize
|
266 |
+
for i in $(seq 1 80);
|
267 |
+
do
|
268 |
+
export N_POOL=15
|
269 |
+
export DATASET_ID=${i}
|
270 |
+
export DIRECTION="enA-esA"
|
271 |
+
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
272 |
+
export LINE_NO_END=$((DATASET_ID * 2500))
|
273 |
+
echo ${LINE_NO_START}
|
274 |
+
python tokenize_dataset_s2s.py
|
275 |
+
done
|
276 |
+
# speaker embedding
|
277 |
+
for i in $(seq 1 80);
|
278 |
+
do
|
279 |
+
export DATASET_ID=${i}
|
280 |
+
export DIRECTION="enA-esA"
|
281 |
+
python attach_speaker_embedding_s2s.py
|
282 |
+
done
|
283 |
+
|
284 |
+
|
285 |
+
####################
|
286 |
+
# enA-jaA: 718_606 #
|
287 |
+
####################
|
288 |
# test
|
289 |
export DATASET_ID=test
|
290 |
+
export DIRECTION="enA-jaA"
|
291 |
export LINE_NO_START=0
|
292 |
export LINE_NO_END=10
|
293 |
python fetch_dataset_s2s.py
|
294 |
+
# main
|
295 |
+
for i in $(seq 1 144);
|
296 |
+
do
|
297 |
+
export N_POOL=15
|
298 |
+
export DATASET_ID=${i}
|
299 |
+
export DIRECTION="enA-jaA"
|
300 |
+
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
301 |
+
export LINE_NO_END=$((DATASET_ID * 2500))
|
302 |
+
echo ${LINE_NO_START}
|
303 |
+
python fetch_dataset_s2s.py
|
304 |
+
done
|
305 |
+
# tokenize
|
306 |
+
for i in $(seq 1 144);
|
307 |
+
do
|
308 |
+
export DATASET_ID=${i}
|
309 |
+
export DIRECTION="enA-jaA"
|
310 |
+
python tokenize_dataset_s2s.py
|
311 |
+
done
|
312 |
+
# speaker embedding
|
313 |
+
for i in $(seq 1 144);
|
314 |
+
do
|
315 |
+
export DATASET_ID=${i}
|
316 |
+
export DIRECTION="enA-jaA"
|
317 |
+
python attach_speaker_embedding_s2s.py
|
318 |
+
done
|
319 |
|
320 |
+
####################
|
321 |
+
# enA-hiA: 454_942 #
|
322 |
+
####################
|
323 |
# test
|
324 |
export DATASET_ID=test
|
325 |
+
export DIRECTION="enA-hiA"
|
326 |
export LINE_NO_START=0
|
327 |
export LINE_NO_END=10
|
328 |
python fetch_dataset_s2s.py
|
329 |
# main
|
330 |
+
for i in $(seq 1 91);
|
331 |
do
|
332 |
export N_POOL=15
|
333 |
export DATASET_ID=${i}
|
334 |
+
export DIRECTION="enA-hiA"
|
335 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
336 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
337 |
echo ${LINE_NO_START}
|
338 |
python fetch_dataset_s2s.py
|
339 |
done
|
340 |
+
# tokenize
|
341 |
+
for i in $(seq 1 91);
|
342 |
+
do
|
343 |
+
export DATASET_ID=${i}
|
344 |
+
export DIRECTION="enA-hiA"
|
345 |
+
python tokenize_dataset_s2s.py
|
346 |
+
done
|
347 |
+
# speaker embedding
|
348 |
+
for i in $(seq 1 91);
|
349 |
+
do
|
350 |
+
export DATASET_ID=${i}
|
351 |
+
export DIRECTION="enA-hiA"
|
352 |
+
python attach_speaker_embedding_s2s.py
|
353 |
+
done
|
354 |
+
####################
|
355 |
+
# enA-viA: 740_598 #
|
356 |
+
####################
|
357 |
+
# test
|
358 |
+
export DATASET_ID=test
|
359 |
+
export DIRECTION="enA-viA"
|
360 |
+
export LINE_NO_START=0
|
361 |
+
export LINE_NO_END=10
|
362 |
+
python fetch_dataset_s2s.py
|
363 |
+
# main
|
364 |
+
for i in $(seq 1 149);
|
365 |
do
|
366 |
export N_POOL=15
|
367 |
export DATASET_ID=${i}
|
368 |
+
export DIRECTION="enA-viA"
|
369 |
export LINE_NO_START=$(((DATASET_ID-1) * 2500))
|
370 |
export LINE_NO_END=$((DATASET_ID * 2500))
|
371 |
echo ${LINE_NO_START}
|
372 |
python fetch_dataset_s2s.py
|
373 |
+
done
|
374 |
+
# tokenize
|
375 |
+
for i in $(seq 1 149);
|
376 |
+
do
|
377 |
+
export DATASET_ID=${i}
|
378 |
+
export DIRECTION="enA-viA"
|
379 |
+
python tokenize_dataset_s2s.py
|
380 |
+
done
|
381 |
+
# speaker embedding
|
382 |
+
for i in $(seq 1 149);
|
383 |
+
do
|
384 |
+
export DATASET_ID=${i}
|
385 |
+
export DIRECTION="enA-viA"
|
386 |
+
python attach_speaker_embedding_s2s.py
|
387 |
done
|
main_s2t.sh
CHANGED
@@ -21,6 +21,22 @@ make -j4
|
|
21 |
alias wet_lines="${PWD}/bin/wet_lines"
|
22 |
cd ../../
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
######################
|
25 |
# enA-jpn: 734_146 #
|
26 |
######################
|
@@ -35,7 +51,7 @@ do
|
|
35 |
done
|
36 |
python format_text.py
|
37 |
# audio
|
38 |
-
for i in $(seq
|
39 |
do
|
40 |
export N_POOL=15
|
41 |
export DATASET_ID=${i}
|
@@ -46,6 +62,7 @@ do
|
|
46 |
echo ${LINE_NO_START}
|
47 |
python fetch_dataset_s2t.py
|
48 |
done
|
|
|
49 |
########
|
50 |
# NLLB #
|
51 |
########
|
|
|
21 |
alias wet_lines="${PWD}/bin/wet_lines"
|
22 |
cd ../../
|
23 |
|
24 |
+
|
25 |
+
######################
|
26 |
+
# enA-est: 734_146 #
|
27 |
+
######################
|
28 |
+
# text
|
29 |
+
export DIRECTION_SPEECH="enA"
|
30 |
+
export DIRECTION_TEXT="est"
|
31 |
+
export CHUNK_SIZE=20
|
32 |
+
python download_s2t_metadata.py
|
33 |
+
for i in $(seq 1 ${CHUNK_SIZE});
|
34 |
+
do
|
35 |
+
cat seamless.dataset.metadata.public.${DIRECTION_SPEECH}-${DIRECTION_TEXT}.withduration.reordered.batch_${i}.tsv | egrep ^crawl-data | tr '\t' ' ' | wet_lines | tee metadata.${DIRECTION_SPEECH}-${DIRECTION_TEXT}.batch_${i}.tsv &
|
36 |
+
done
|
37 |
+
python format_text.py
|
38 |
+
|
39 |
+
|
40 |
######################
|
41 |
# enA-jpn: 734_146 #
|
42 |
######################
|
|
|
51 |
done
|
52 |
python format_text.py
|
53 |
# audio
|
54 |
+
for i in $(seq 140 294);
|
55 |
do
|
56 |
export N_POOL=15
|
57 |
export DATASET_ID=${i}
|
|
|
62 |
echo ${LINE_NO_START}
|
63 |
python fetch_dataset_s2t.py
|
64 |
done
|
65 |
+
|
66 |
########
|
67 |
# NLLB #
|
68 |
########
|
speaker_embedding_clap.py
ADDED
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
"""CLAP embedding.
|
2 |
+
- feature dimension: 512
|
3 |
+
- source: https://huggingface.co/laion/larger_clap_music_and_speech
|
4 |
+
"""
|
5 |
+
from typing import Optional
|
6 |
+
|
7 |
+
import torch
|
8 |
+
import librosa
|
9 |
+
import numpy as np
|
10 |
+
from transformers import ClapModel, ClapProcessor
|
11 |
+
|
12 |
+
|
13 |
+
class ClapSE:
|
14 |
+
def __init__(self, ckpt: str = "laion/larger_clap_music_and_speech"):
|
15 |
+
self.model = ClapModel.from_pretrained(ckpt)
|
16 |
+
self.device = torch.device("cuda" if torch.cuda.is_available() else "cpu")
|
17 |
+
self.model.to(self.device)
|
18 |
+
self.model.eval()
|
19 |
+
self.processor = ClapProcessor.from_pretrained(ckpt)
|
20 |
+
|
21 |
+
def get_speaker_embedding(self, wav: np.ndarray, sampling_rate: Optional[int] = None) -> np.ndarray:
|
22 |
+
if sampling_rate != self.processor.feature_extractor.sampling_rate:
|
23 |
+
wav = librosa.resample(wav, orig_sr=sampling_rate, target_sr=self.processor.feature_extractor.sampling_rate)
|
24 |
+
inputs = self.processor(
|
25 |
+
audios=wav, sampling_rate=self.processor.feature_extractor.sampling_rate, return_tensors="pt"
|
26 |
+
)
|
27 |
+
with torch.no_grad():
|
28 |
+
outputs = self.model.get_audio_features(**{k: v.to(self.device) for k, v in inputs.items()})
|
29 |
+
return outputs.cpu().numpy()[0]
|
30 |
+
|
31 |
+
|
32 |
+
class ClapGeneralSE(ClapSE):
|
33 |
+
|
34 |
+
def __init__(self):
|
35 |
+
super().__init__(ckpt="laion/larger_clap_general")
|