spapi commited on
Commit
8b9f52e
·
verified ·
1 Parent(s): 85d9148

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +146 -3
README.md CHANGED
@@ -1,3 +1,146 @@
1
- ---
2
- license: cc-by-nc-4.0
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-nc-4.0
3
+ ---
4
+ # SimulSeamless
5
+ ![ACL Anthology](https://img.shields.io/badge/anthology-brightgreen?logo=data%3Aimage%2Fsvg%2Bxml%3Bbase64%2CPD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiIHN0YW5kYWxvbmU9Im5vIj8%2BCjwhLS0gQ3JlYXRlZCB3aXRoIElua3NjYXBlIChodHRwOi8vd3d3Lmlua3NjYXBlLm9yZy8pIC0tPgo8c3ZnCiAgIHhtbG5zOnN2Zz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciCiAgIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIKICAgdmVyc2lvbj0iMS4wIgogICB3aWR0aD0iNjgiCiAgIGhlaWdodD0iNjgiCiAgIGlkPSJzdmcyIj4KICA8ZGVmcwogICAgIGlkPSJkZWZzNCIgLz4KICA8cGF0aAogICAgIGQ9Ik0gNDEuOTc3NTUzLC0yLjg0MjE3MDllLTAxNCBDIDQxLjk3NzU1MywxLjc2MTc4IDQxLjk3NzU1MywxLjQ0MjExIDQxLjk3NzU1MywzLjAxNTggTCA3LjQ4NjkwNTQsMy4wMTU4IEwgMCwzLjAxNTggTCAwLDEwLjUwMDc5IEwgMCwzOC40Nzg2NyBMIDAsNDYgTCA3LjQ4NjkwNTQsNDYgTCA0OS41MDA4MDIsNDYgTCA1Ni45ODc3MDgsNDYgTCA2OCw0NiBMIDY4LDMwLjk5MzY4IEwgNTYuOTg3NzA4LDMwLjk5MzY4IEwgNTYuOTg3NzA4LDEwLjUwMDc5IEwgNTYuOTg3NzA4LDMuMDE1OCBDIDU2Ljk4NzcwOCwxLjQ0MjExIDU2Ljk4NzcwOCwxLjc2MTc4IDU2Ljk4NzcwOCwtMi44NDIxNzA5ZS0wMTQgTCA0MS45Nzc1NTMsLTIuODQyMTcwOWUtMDE0IHogTSAxNS4wMTAxNTUsMTcuOTg1NzggTCA0MS45Nzc1NTMsMTcuOTg1NzggTCA0MS45Nzc1NTMsMzAuOTkzNjggTCAxNS4wMTAxNTUsMzAuOTkzNjggTCAxNS4wMTAxNTUsMTcuOTg1NzggeiAiCiAgICAgc3R5bGU9ImZpbGw6I2VkMWMyNDtmaWxsLW9wYWNpdHk6MTtmaWxsLXJ1bGU6ZXZlbm9kZDtzdHJva2U6bm9uZTtzdHJva2Utd2lkdGg6MTIuODk1NDExNDk7c3Ryb2tlLWxpbmVjYXA6YnV0dDtzdHJva2UtbGluZWpvaW46bWl0ZXI7c3Ryb2tlLW1pdGVybGltaXQ6NDtzdHJva2UtZGFzaGFycmF5Om5vbmU7c3Ryb2tlLWRhc2hvZmZzZXQ6MDtzdHJva2Utb3BhY2l0eToxIgogICAgIHRyYW5zZm9ybT0idHJhbnNsYXRlKDAsIDExKSIKICAgICBpZD0icmVjdDIxNzgiIC8%2BCjwvc3ZnPgo%3D&label=ACL&labelColor=white&color=red)
6
+
7
+ Code for the paper: ["SimulSeamless: FBK at IWSLT 2024 Simultaneous Speech Translation"](http://arxiv.org/abs/2406.14177) published at IWSLT 2024.
8
+
9
+ ## 📎 Requirements
10
+ To run the agent, please make sure that
11
+ [SimulEval v1.1.0](https://github.com/facebookresearch/SimulEval)
12
+ and [HuggingFace Transformers](https://huggingface.co/docs/transformers/index) are installed.
13
+
14
+ In the case of [💬 Inference using docker](#-inference-using-docker), use commit
15
+ `f1f5b9a69a47496630aa43605f1bd46e5484a2f4` for SimulEval.
16
+
17
+ ## 🤖 Inference using your environment
18
+ Please, set `--source`, and `--target` as described in the
19
+ [Fairseq Simultaneous Translation repository](https://github.com/facebookresearch/fairseq/blob/main/examples/speech_to_text/docs/simulst_mustc_example.md#inference--evaluation):
20
+ `${LIST_OF_AUDIO}` is the list of audio paths and `${TGT_FILE}` the segment-wise references in the
21
+ target language.
22
+
23
+ Set `${TGT_LANG}` as the target language code in 3 characters. The list of supported language
24
+ codes is
25
+ [available here](https://huggingface.co/facebook/hf-seamless-m4t-medium/blob/main/special_tokens_map.json).
26
+ For the source language, no language code has to be specified.
27
+
28
+ Depending on the target language, set `${LATENCY_UNIT}` to either `word` (e.g., for German) or
29
+ `char` (e.g., for Japanese), and `${BLEU_TOKENIZER}` to either `13a` (i.e., the standard sacreBLEU
30
+ tokenizer used, for example, to evaluate German) or `char` (e.g., to evaluate character-level
31
+ languages such as Chinese or Japanese).
32
+
33
+ The simultaneous inference of SimulSeamless is based on
34
+ [AlignAtt](ALIGNATT_SIMULST_AGENT_INTERSPEECH2023.md), thus the __f__ parameter (`${FRAME}`) and the
35
+ layer from which to extract the attention scores (`${LAYER}`) have to be set accordingly.
36
+
37
+ ### Instruction to replicate IWSLT 2024 results ↙️
38
+
39
+ To replicate the results obtained to achieve 2 seconds of latency (measured by AL) on the test sets
40
+ used by [the IWSLT 2024 Simultaneous track](https://iwslt.org/2024/simultaneous), use the following
41
+ values:
42
+ - **en-de**: `${TGT_LANG}=deu`, `${FRAME}=6`, `${LAYER}=3`, `${SEG_SIZE}=1000`
43
+ - **en-ja**: `${TGT_LANG}=jpn`, `${FRAME}=1`, `${LAYER}=0`, `${SEG_SIZE}=400`
44
+ - **en-zh**: `${TGT_LANG}=cmn`, `${FRAME}=1`, `${LAYER}=3`, `${SEG_SIZE}=800`
45
+ - **cs-en**: `${TGT_LANG}=eng`, `${FRAME}=9`, `${LAYER}=3`, `${SEG_SIZE}=1000`
46
+
47
+ ❗️Please notice that `${FRAME}` can be adjusted to achieve lower/higher latency.
48
+
49
+
50
+ The SimulSeamless can be run with:
51
+ ```bash
52
+ simuleval \
53
+ --agent-class examples.speech_to_text.simultaneous_translation.agents.v1_1.simul_alignatt_seamlessm4t.AlignAttSeamlessS2T \
54
+ --source ${LIST_OF_AUDIO} \
55
+ --target ${TGT_FILE} \
56
+ --data-bin ${DATA_ROOT} \
57
+ --model-size medium --target-language ${TGT_LANG} \
58
+ --extract-attn-from-layer ${LAYER} --num-beams 5 \
59
+ --frame-num ${FRAME} \
60
+ --source-segment-size ${SEG_SIZE} \
61
+ --quality-metrics BLEU --latency-metrics LAAL AL ATD --computation-aware \
62
+ --eval-latency-unit ${LATENCY_UNIT} --sacrebleu-tokenizer ${BLEU_TOKENIZER} \
63
+ --output ${OUT_DIR} \
64
+ --device cuda:0
65
+ ```
66
+ If not already stored in your system, the SeamlessM4T model will be downloaded automatically when
67
+ running the script. The output will be saved in `${OUT_DIR}`.
68
+
69
+ We suggest to run the inference using a GPU to speed up the process but the system can be run on
70
+ any device (e.g., CPU) supported by SimulEval and HuggingFace.
71
+
72
+ ## 💬 Inference using docker
73
+ To run SimulSeamless using docker, as required by the IWSLT 2024 Simultaneous track, follow the
74
+ steps below:
75
+ 1. Download the docker file [simulseamless.tar](https://fbk-my.sharepoint.com/:u:/g/personal/spapi_fbk_eu/EWcMkUFCB59PtmtncHUmkRABGw-AwJn5iJ5Q8zIihfvnag?e=k6DxM0)
76
+ 2. Load the docker image:
77
+ ```bash
78
+ docker load -i simulseamless.tar
79
+ ```
80
+ 3. Start the SimulEval standalone with GPU enabled:
81
+ ```bash
82
+ docker run -e TGTLANG=${TGT_LANG} -e FRAME=${FRAME} -e LAYER=${LAYER} \
83
+ -e BLEU_TOKENIZER=${BLEU_TOKENIZER} -e LATENCY_UNIT=${LATENCY_UNIT} \
84
+ -e DEV=cuda:0 --gpus all --shm-size 32G \
85
+ -p 2024:2024 simulseamless:latest
86
+ ```
87
+ 4. Start the remote evaluation with:
88
+ ```bash
89
+ simuleval \
90
+ --remote-eval --remote-port 2024 \
91
+ --source ${LIST_OF_AUDIO} --target ${TGT_FILE} \
92
+ --source-type speech --target-type text \
93
+ --source-segment-size ${SEG_SIZE} \
94
+ --eval-latency-unit ${LATENCY_UNIT} --sacrebleu-tokenizer ${BLEU_TOKENIZER} \
95
+ --output ${OUT_DIR}
96
+ ```
97
+ To set, `${TGT_LANG}`, `${FRAME}`, `${LAYER}`, `${BLEU_TOKENIZER}`, `${LATENCY_UNIT}`,
98
+ `${LIST_OF_AUDIO}`, `${TGT_FILE}`, `${SEG_SIZE}`, and `${OUT_DIR}` refer to
99
+ [🤖 Inference using your environment](#-inference-using-your-environment).
100
+
101
+ ### Instruction to recreate the docker images <img height="20" width="25" src="https://cdn.jsdelivr.net/npm/simple-icons@v11/icons/docker.svg" />
102
+
103
+ To recreate the docker images, follow the steps below.
104
+
105
+ 1. Download SimulEval and this repository.
106
+ 2. Create a `Dockerfile` with the following content:
107
+ ```
108
+ FROM python:3.9
109
+ RUN pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113
110
+ ADD /SimulEval /SimulEval
111
+ WORKDIR /SimulEval
112
+ RUN pip install -e .
113
+ WORKDIR ../
114
+ ADD /fbk-fairseq /fbk-fairseq
115
+ WORKDIR /fbk-fairseq
116
+ RUN pip install -e .
117
+ RUN pip install -r speech_requirements.txt
118
+ WORKDIR ../
119
+ RUN pip install sentencepiece
120
+ RUN pip install transformers
121
+
122
+ ENTRYPOINT simuleval --standalone --remote-port 2024 \
123
+ --agent-class examples.speech_to_text.simultaneous_translation.agents.v1_1.simul_alignatt_seamlessm4t.AlignAttSeamlessS2T \
124
+ --model-size medium --num-beams 5 --user-dir fbk-fairseq/examples \
125
+ --target-language $TGTLANG --frame-num $FRAME --extract-attn-from-layer $LAYER --device $DEV \
126
+ --sacrebleu-tokenizer ${BLEU_TOKENIZER} --eval-latency-unit ${LATENCY_UNIT}
127
+ ```
128
+ 3. Build the docker image:
129
+ ```
130
+ docker build -t simulseamless .
131
+ ```
132
+ 4. Save the docker image:
133
+ ```
134
+ docker save -o simulseamless.tar simulseamless:latest
135
+ ```
136
+
137
+ ## 📍Citation
138
+ ```bibtex
139
+ @inproceedings{papi-et-al-2024-simulseamless,
140
+ title = "SimulSeamless: FBK at IWSLT 2024 Simultaneous Speech Translation",
141
+ author = {Papi, Sara and Gaido, Marco and Negri, Matteo and Bentivogli, Luisa},
142
+ booktitle = "Proceedings of the 21th International Conference on Spoken Language Translation (IWSLT)",
143
+ year = "2024",
144
+ address = "Bangkok, Thailand",
145
+ }
146
+ ```