Initial Commit
Browse files
README.md
CHANGED
@@ -1,3 +1,360 @@
|
|
1 |
-
---
|
2 |
-
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
---
|
2 |
+
language:
|
3 |
+
- ace
|
4 |
+
- acm
|
5 |
+
- acq
|
6 |
+
- aeb
|
7 |
+
- af
|
8 |
+
- ajp
|
9 |
+
- ak
|
10 |
+
- als
|
11 |
+
- am
|
12 |
+
- apc
|
13 |
+
- ar
|
14 |
+
- ars
|
15 |
+
- ary
|
16 |
+
- arz
|
17 |
+
- as
|
18 |
+
- ast
|
19 |
+
- awa
|
20 |
+
- ayr
|
21 |
+
- azb
|
22 |
+
- azj
|
23 |
+
- ba
|
24 |
+
- bm
|
25 |
+
- ban
|
26 |
+
- be
|
27 |
+
- bem
|
28 |
+
- bn
|
29 |
+
- bho
|
30 |
+
- bjn
|
31 |
+
- bo
|
32 |
+
- bs
|
33 |
+
- bug
|
34 |
+
- bg
|
35 |
+
- ca
|
36 |
+
- ceb
|
37 |
+
- cs
|
38 |
+
- cjk
|
39 |
+
- ckb
|
40 |
+
- crh
|
41 |
+
- cy
|
42 |
+
- da
|
43 |
+
- de
|
44 |
+
- dik
|
45 |
+
- dyu
|
46 |
+
- dz
|
47 |
+
- el
|
48 |
+
- en
|
49 |
+
- eo
|
50 |
+
- et
|
51 |
+
- eu
|
52 |
+
- ee
|
53 |
+
- fo
|
54 |
+
- fj
|
55 |
+
- fi
|
56 |
+
- fon
|
57 |
+
- fr
|
58 |
+
- fur
|
59 |
+
- fuv
|
60 |
+
- gaz
|
61 |
+
- gd
|
62 |
+
- ga
|
63 |
+
- gl
|
64 |
+
- gn
|
65 |
+
- gu
|
66 |
+
- ht
|
67 |
+
- ha
|
68 |
+
- he
|
69 |
+
- hi
|
70 |
+
- hne
|
71 |
+
- hr
|
72 |
+
- hu
|
73 |
+
- hy
|
74 |
+
- ig
|
75 |
+
- ilo
|
76 |
+
- id
|
77 |
+
- is
|
78 |
+
- it
|
79 |
+
- jv
|
80 |
+
- ja
|
81 |
+
- kab
|
82 |
+
- kac
|
83 |
+
- kam
|
84 |
+
- kn
|
85 |
+
- ks
|
86 |
+
- ka
|
87 |
+
- kk
|
88 |
+
- kbp
|
89 |
+
- kea
|
90 |
+
- khk
|
91 |
+
- km
|
92 |
+
- ki
|
93 |
+
- rw
|
94 |
+
- ky
|
95 |
+
- kmb
|
96 |
+
- kmr
|
97 |
+
- knc
|
98 |
+
- kg
|
99 |
+
- ko
|
100 |
+
- lo
|
101 |
+
- lij
|
102 |
+
- li
|
103 |
+
- ln
|
104 |
+
- lt
|
105 |
+
- lmo
|
106 |
+
- ltg
|
107 |
+
- lb
|
108 |
+
- lua
|
109 |
+
- lg
|
110 |
+
- luo
|
111 |
+
- lus
|
112 |
+
- lvs
|
113 |
+
- mag
|
114 |
+
- mai
|
115 |
+
- ml
|
116 |
+
- mar
|
117 |
+
- min
|
118 |
+
- mk
|
119 |
+
- mt
|
120 |
+
- mni
|
121 |
+
- mos
|
122 |
+
- mi
|
123 |
+
- my
|
124 |
+
- nl
|
125 |
+
- nn
|
126 |
+
- nb
|
127 |
+
- npi
|
128 |
+
- nso
|
129 |
+
- nus
|
130 |
+
- ny
|
131 |
+
- oc
|
132 |
+
- ory
|
133 |
+
- pag
|
134 |
+
- pa
|
135 |
+
- pap
|
136 |
+
- pbt
|
137 |
+
- pes
|
138 |
+
- plt
|
139 |
+
- pl
|
140 |
+
- pt
|
141 |
+
- prs
|
142 |
+
- quy
|
143 |
+
- ro
|
144 |
+
- rn
|
145 |
+
- ru
|
146 |
+
- sg
|
147 |
+
- sa
|
148 |
+
- sat
|
149 |
+
- scn
|
150 |
+
- shn
|
151 |
+
- si
|
152 |
+
- sk
|
153 |
+
- sl
|
154 |
+
- sm
|
155 |
+
- sn
|
156 |
+
- sd
|
157 |
+
- so
|
158 |
+
- st
|
159 |
+
- es
|
160 |
+
- sc
|
161 |
+
- sr
|
162 |
+
- ss
|
163 |
+
- su
|
164 |
+
- sv
|
165 |
+
- swh
|
166 |
+
- szl
|
167 |
+
- ta
|
168 |
+
- taq
|
169 |
+
- tt
|
170 |
+
- te
|
171 |
+
- tg
|
172 |
+
- tl
|
173 |
+
- th
|
174 |
+
- ti
|
175 |
+
- tpi
|
176 |
+
- tn
|
177 |
+
- ts
|
178 |
+
- tk
|
179 |
+
- tum
|
180 |
+
- tr
|
181 |
+
- tw
|
182 |
+
- tzm
|
183 |
+
- ug
|
184 |
+
- uk
|
185 |
+
- umb
|
186 |
+
- ur
|
187 |
+
- uzn
|
188 |
+
- vec
|
189 |
+
- vi
|
190 |
+
- war
|
191 |
+
- wo
|
192 |
+
- xh
|
193 |
+
- ydd
|
194 |
+
- yo
|
195 |
+
- yue
|
196 |
+
- zh
|
197 |
+
- zsm
|
198 |
+
- zu
|
199 |
+
language_details: >-
|
200 |
+
ace_Arab, ace_Latn, acm_Arab, acq_Arab, aeb_Arab, afr_Latn, ajp_Arab,
|
201 |
+
aka_Latn, amh_Ethi, apc_Arab, arb_Arab, ars_Arab, ary_Arab, arz_Arab,
|
202 |
+
asm_Beng, ast_Latn, awa_Deva, ayr_Latn, azb_Arab, azj_Latn, bak_Cyrl,
|
203 |
+
bam_Latn, ban_Latn,bel_Cyrl, bem_Latn, ben_Beng, bho_Deva, bjn_Arab, bjn_Latn,
|
204 |
+
bod_Tibt, bos_Latn, bug_Latn, bul_Cyrl, cat_Latn, ceb_Latn, ces_Latn,
|
205 |
+
cjk_Latn, ckb_Arab, crh_Latn, cym_Latn, dan_Latn, deu_Latn, dik_Latn,
|
206 |
+
dyu_Latn, dzo_Tibt, ell_Grek, eng_Latn, epo_Latn, est_Latn, eus_Latn,
|
207 |
+
ewe_Latn, fao_Latn, pes_Arab, fij_Latn, fin_Latn, fon_Latn, fra_Latn,
|
208 |
+
fur_Latn, fuv_Latn, gla_Latn, gle_Latn, glg_Latn, grn_Latn, guj_Gujr,
|
209 |
+
hat_Latn, hau_Latn, heb_Hebr, hin_Deva, hne_Deva, hrv_Latn, hun_Latn,
|
210 |
+
hye_Armn, ibo_Latn, ilo_Latn, ind_Latn, isl_Latn, ita_Latn, jav_Latn,
|
211 |
+
jpn_Jpan, kab_Latn, kac_Latn, kam_Latn, kan_Knda, kas_Arab, kas_Deva,
|
212 |
+
kat_Geor, knc_Arab, knc_Latn, kaz_Cyrl, kbp_Latn, kea_Latn, khm_Khmr,
|
213 |
+
kik_Latn, kin_Latn, kir_Cyrl, kmb_Latn, kon_Latn, kor_Hang, kmr_Latn,
|
214 |
+
lao_Laoo, lvs_Latn, lij_Latn, lim_Latn, lin_Latn, lit_Latn, lmo_Latn,
|
215 |
+
ltg_Latn, ltz_Latn, lua_Latn, lug_Latn, luo_Latn, lus_Latn, mag_Deva,
|
216 |
+
mai_Deva, mal_Mlym, mar_Deva, min_Latn, mkd_Cyrl, plt_Latn, mlt_Latn,
|
217 |
+
mni_Beng, khk_Cyrl, mos_Latn, mri_Latn, zsm_Latn, mya_Mymr, nld_Latn,
|
218 |
+
nno_Latn, nob_Latn, npi_Deva, nso_Latn, nus_Latn, nya_Latn, oci_Latn,
|
219 |
+
gaz_Latn, ory_Orya, pag_Latn, pan_Guru, pap_Latn, pol_Latn, por_Latn,
|
220 |
+
prs_Arab, pbt_Arab, quy_Latn, ron_Latn, run_Latn, rus_Cyrl, sag_Latn,
|
221 |
+
san_Deva, sat_Beng, scn_Latn, shn_Mymr, sin_Sinh, slk_Latn, slv_Latn,
|
222 |
+
smo_Latn, sna_Latn, snd_Arab, som_Latn, sot_Latn, spa_Latn, als_Latn,
|
223 |
+
srd_Latn, srp_Cyrl, ssw_Latn, sun_Latn, swe_Latn, swh_Latn, szl_Latn,
|
224 |
+
tam_Taml, tat_Cyrl, tel_Telu, tgk_Cyrl, tgl_Latn, tha_Thai, tir_Ethi,
|
225 |
+
taq_Latn, taq_Tfng, tpi_Latn, tsn_Latn, tso_Latn, tuk_Latn, tum_Latn,
|
226 |
+
tur_Latn, twi_Latn, tzm_Tfng, uig_Arab, ukr_Cyrl, umb_Latn, urd_Arab,
|
227 |
+
uzn_Latn, vec_Latn, vie_Latn, war_Latn, wol_Latn, xho_Latn, ydd_Hebr,
|
228 |
+
yor_Latn, yue_Hant, zho_Hans, zho_Hant, zul_Latn
|
229 |
+
license: mit
|
230 |
+
metrics:
|
231 |
+
- bleu
|
232 |
+
datasets:
|
233 |
+
- mozilla-foundation/common_voice_8_0
|
234 |
+
pipeline_tag: automatic-speech-recognition
|
235 |
+
tags:
|
236 |
+
- zeroswot
|
237 |
+
- speech translation
|
238 |
+
- zero-shot
|
239 |
+
- end-to-end
|
240 |
+
- nllb
|
241 |
+
- wav2vec2
|
242 |
+
---
|
243 |
+
|
244 |
+
# ZeroSwot ✨🤖✨
|
245 |
+
|
246 |
+
<!-- <div style='display:flex; gap: 0.25rem; '>
|
247 |
+
<a href='https://arxiv.org/abs/2402.10422'><img src='https://img.shields.io/badge/paper-PDF-green'></a>
|
248 |
+
<a href='https://github.com/mt-upc/ZeroSwot/blob/main/LICENSE'><img src='https://img.shields.io/badge/License-MIT-blue.svg'></a>
|
249 |
+
<a href='https://github.com/mt-upc/ZeroSwot'><img src='https://img.shields.io/badge/github-%23121011.svg?style=for-the-badge&logo=github&logoColor=white'></a>
|
250 |
+
</div> -->
|
251 |
+
|
252 |
+
ZeroSwot is a state-of-the-art zero-shot end-to-end Speech Translation system.
|
253 |
+
|
254 |
+
<div align=center><img src="resources/intro.png" height="65%" width="65%"/></div>
|
255 |
+
|
256 |
+
The model is created by adapting a wav2vec2.0-based encoder to the embedding space of NLLB, using a novel subword compression module and Optimal Transport, while only utilizing ASR data. It thus enables **Zero-shot E2E Speech Translation to all the 200 languages supported by NLLB**.
|
257 |
+
|
258 |
+
For more details please refer to our [paper](https://arxiv.org/abs/2402.10422) and the [original repo](https://github.com/mt-upc/ZeroSwot) build on fairseq.
|
259 |
+
|
260 |
+
## Architecture
|
261 |
+
|
262 |
+
The compression module is a light-weight transformer that takes as input the hidden state of wav2vec2.0 and the corresponding CTC predictions, and compresses them to subword-like embeddings similar to those expected from NLLB and aligns them using Optimal Transport. For inference we simply pass the output of the speech encoder to NLLB encoder.
|
263 |
+
|
264 |
+
<div align=center><img src="resources/methodology.png" height="120%" width="120%"/></div>
|
265 |
+
|
266 |
+
## Version
|
267 |
+
|
268 |
+
This version of ZeroSwot is trained with ASR data from CommonVoice, and adapted [wav2vec2.0-large](https://huggingface.co/facebook/wav2vec2-large-960h-lv60-self) to the [nllb-200-distilled-600M](https://huggingface.co/facebook/nllb-200-distilled-600M) model.
|
269 |
+
|
270 |
+
We have more versions available:
|
271 |
+
|
272 |
+
| Models | ASR data | NLLB version |
|
273 |
+
|:------:|:--------:|:------------:|
|
274 |
+
| [ZeroSwot-Medium_asr-mustc](https://huggingface.co/johntsi/ZeroSwot-Medium_asr-mustc_en-to-200) | MuST-C v1.0 | [distilled-600M original](https://huggingface.co/facebook/nllb-200-distilled-600M)|
|
275 |
+
| [ZeroSwot-Medium_asr-mustc_mt-mustc](https://huggingface.co/johntsi/ZeroSwot-Medium_asr-mustc_mt-mustc_en-to-8) | MuST-C v1.0 | [distilled-600M finetuned w/ MuST-C](https://huggingface.co/johntsi/nllb-200-distilled-600M_mustc_en-to-8) |
|
276 |
+
| [ZeroSwot-Large_asr-mustc](https://huggingface.co/johntsi/ZeroSwot-Large_asr-mustc_en-to-200) | MuST-C v1.0 | [distilled-1.3B original](https://huggingface.co/facebook/nllb-200-distilled-1.3B) |
|
277 |
+
| [ZeroSwot-Large_asr-mustc_mt-mustc](https://huggingface.co/johntsi/ZeroSwot-Large_asr-mustc_mt-mustc_en-to-8) | MuST-C v1.0 | [distilled-1.3B finetuned w/ MuST-C](https://huggingface.co/johntsi/nllb-200-distilled-1.3B_mustc_en-to-8) |
|
278 |
+
| [ZeroSwot-Medium_asr-cv](https://huggingface.co/johntsi/ZeroSwot-Medium_asr-cv_en-to-200) | CommonVoice | [distilled-600M original](https://huggingface.co/facebook/nllb-200-distilled-600M)|
|
279 |
+
| [ZeroSwot-Medium_asr-cv_mt-covost2](https://huggingface.co/johntsi/ZeroSwot-Medium_asr-cv_mt-covost2_en-to-15) | CommonVoice | [distilled-600M finetuned w/ CoVoST2](https://huggingface.co/johntsi/nllb-200-distilled-600M_covost2_en-to-15) |
|
280 |
+
| [ZeroSwot-Large_asr-cv](https://huggingface.co/johntsi/ZeroSwot-Large_asr-cv_en-to-200) | CommonVoice | [distilled-1.3B original](https://huggingface.co/facebook/nllb-200-distilled-1.3B) |
|
281 |
+
| [ZeroSwot-Large_asr-cv_mt-covost2](https://huggingface.co/johntsi/ZeroSwot-Large_asr-cv_mt-covost2_en-to-15) | CommonVoice | [distilled-1.3B finetuned w/ CoVoST2](https://huggingface.co/johntsi/nllb-200-distilled-1.3B_covost2_en-to-15) |
|
282 |
+
|
283 |
+
## Usage
|
284 |
+
|
285 |
+
The model is tested with python 3.9.16 and Transformer v4.41.2. Install also torchaudio and sentencepiece for processing.
|
286 |
+
|
287 |
+
```bash
|
288 |
+
pip install transformers torchaudio sentencepiece
|
289 |
+
```
|
290 |
+
|
291 |
+
|
292 |
+
```python
|
293 |
+
from transformers import Wav2Vec2Processor, NllbTokenizer, AutoModel, AutoModelForSeq2SeqLM
|
294 |
+
import torchaudio
|
295 |
+
|
296 |
+
def load_and_resample_audio(audio_path, target_sr=16000):
|
297 |
+
audio, orig_freq = torchaudio.load(audio_path)
|
298 |
+
if orig_freq != target_sr:
|
299 |
+
audio = torchaudio.functional.resample(audio, orig_freq=orig_freq, new_freq=target_sr)
|
300 |
+
audio = audio.squeeze(0).numpy()
|
301 |
+
return audio
|
302 |
+
|
303 |
+
# Load processors and tokenizers
|
304 |
+
processor = Wav2Vec2Processor.from_pretrained("facebook/wav2vec2-large-960h-lv60-self")
|
305 |
+
tokenizer = NllbTokenizer.from_pretrained("facebook/nllb-200-distilled-600M")
|
306 |
+
|
307 |
+
# Load ZeroSwot Encoder
|
308 |
+
commit_hash = "eafabee295ea1c8b45483d1fd26bd747d9a7d937"
|
309 |
+
zeroswot_encoder = AutoModel.from_pretrained(
|
310 |
+
"johntsi/ZeroSwot-Medium_asr-cv_en-to-200", trust_remote_code=True, revision=commit_hash,
|
311 |
+
)
|
312 |
+
zeroswot_encoder.eval()
|
313 |
+
zeroswot_encoder.to("cuda")
|
314 |
+
|
315 |
+
# Load NLLB Model
|
316 |
+
nllb_model = AutoModelForSeq2SeqLM.from_pretrained("facebook/nllb-200-distilled-600M")
|
317 |
+
nllb_model.eval()
|
318 |
+
nllb_model.to("cuda")
|
319 |
+
|
320 |
+
# Load audio file
|
321 |
+
audio = load_and_resample_audio(path_to_audio_file) # you can use "resources/sample.wav" for testing
|
322 |
+
input_values = processor(audio, sampling_rate=16000, return_tensors="pt").to("cuda")
|
323 |
+
|
324 |
+
# translation to German
|
325 |
+
compressed_embeds, attention_mask = zeroswot_encoder(**input_values)
|
326 |
+
predicted_ids = nllb_model.generate(
|
327 |
+
inputs_embeds=compressed_embeds,
|
328 |
+
attention_mask=attention_mask,
|
329 |
+
forced_bos_token_id=tokenizer.lang_code_to_id["deu_Latn"],
|
330 |
+
num_beams=5,
|
331 |
+
)
|
332 |
+
translation = tokenizer.decode(predicted_ids[0], skip_special_tokens=True)
|
333 |
+
print(translation)
|
334 |
+
```
|
335 |
+
|
336 |
+
## Results
|
337 |
+
|
338 |
+
BLEU scores on CoVoST-2 test compared to supervised SOTA models [XLS-R-1B](https://huggingface.co/facebook/wav2vec2-xls-r-1b) and [SeamlessM4T-Medium](https://huggingface.co/facebook/seamless-m4t-medium). You can refer to Table 5 of the Results section in the paper for more details.
|
339 |
+
|
340 |
+
| Models | ZS | Size (B) | Ar | Ca | Cy | De | Et | Fa | Id | Ja | Lv | Mn | Sl | Sv | Ta | Tr | Zh | Average |
|
341 |
+
|:--------------:|:----:|:----------:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:----:|:-------:|
|
342 |
+
| [XLS-R-1B](https://huggingface.co/facebook/wav2vec2-xls-r-1b) | ✗ | 1.0 | 19.2 | 32.1 | **31.8** | 26.2 | 22.4 | 21.3 | 30.3 | 39.9 | 22.0 | 14.9 | 25.4 | 32.3 | 18.1 | 17.1 | 36.7 | 26.0 |
|
343 |
+
| [SeamlessM4T-Medium](https://huggingface.co/facebook/seamless-m4t-medium) | ✗ | 1.2 | 20.8 | 37.3 | 29.9 | **31.4** | 23.3 | 17.2 | 34.8 | 37.5 | 19.5 | 12.9 | 29.0 | 37.3 | 18.9 | **19.8** | 30.0 | 26.6 |
|
344 |
+
| [ZeroSwot-M_asr-cv](https://huggingface.co/johntsi/ZeroSwot-Medium_asr-cv_en-to-200) | ✓ | 0.35/0.95 | 17.6 | 32.5 | 18.0 | 29.9 | 20.4 | 16.3 | 32.4 | 32.0 | 13.3 | 10.0 | 25.2 | 34.4 | 17.8 | 15.6 | 30.5 | 23.1 |
|
345 |
+
| [ZeroSwot-M_asr-cv_mt-covost2](https://huggingface.co/johntsi/ZeroSwot-Medium_asr-cv_mt-covost2_en-to-200) | ✓ | 0.35/0.95 | **24.4** | **38.7** | 28.8 | 31.2 | **26.2** | **26.0** | **36.0** | **46.0** | **24.8** | **19.0** | **31.6** | **37.8** | **24.4** | 18.6 | **39.0** | **30.2** |
|
346 |
+
|
347 |
+
## Citation
|
348 |
+
|
349 |
+
If you find ZeroSwot useful for your research, please cite our paper :)
|
350 |
+
|
351 |
+
```
|
352 |
+
@misc{tsiamas2024pushing,
|
353 |
+
title={{Pushing the Limits of Zero-shot End-to-End Speech Translation}},
|
354 |
+
author={Ioannis Tsiamas and Gerard I. Gállego and José A. R. Fonollosa and Marta R. Costa-jussà},
|
355 |
+
year={2024},
|
356 |
+
eprint={2402.10422},
|
357 |
+
archivePrefix={arXiv},
|
358 |
+
primaryClass={cs.CL}
|
359 |
+
}
|
360 |
+
```
|
model.py
CHANGED
@@ -86,7 +86,7 @@ class ZeroSwotEncoderModel(PreTrainedModel):
|
|
86 |
# BOS and EOS embeddings
|
87 |
x, mask = self.speech_embedder(x, mask) # [B, N+2, D]
|
88 |
|
89 |
-
return x, mask
|
90 |
|
91 |
|
92 |
class SpeechEmbedder(nn.Module):
|
|
|
86 |
# BOS and EOS embeddings
|
87 |
x, mask = self.speech_embedder(x, mask) # [B, N+2, D]
|
88 |
|
89 |
+
return x, ~mask
|
90 |
|
91 |
|
92 |
class SpeechEmbedder(nn.Module):
|