Changhan commited on
Commit
da72488
1 Parent(s): 2a09b0d

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +92 -4
README.md CHANGED
@@ -4,9 +4,97 @@ task: audio-to-audio
4
  tags:
5
  - fairseq
6
  - audio
7
- - audio-to-audio
8
- language: en
9
  datasets:
10
- - ljspeech
 
 
11
  ---
12
- ## Example
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4
  tags:
5
  - fairseq
6
  - audio
7
+ - speech-to-speech-translation
8
+ language: en-es
9
  datasets:
10
+ - must_c
11
+ - europarl_st
12
+ - voxpopuli
13
  ---
14
+ # xm_transformer_600m-en_es-multi_domain
15
+
16
+ [W2V2-Transformer](https://aclanthology.org/2021.acl-long.68/) speech-to-text translation model from fairseq S2T ([paper](https://arxiv.org/abs/2010.05171)/[code](https://github.com/pytorch/fairseq/tree/main/examples/speech_to_text)):
17
+ - English-Spanish
18
+ - Trained on MuST-C, EuroParl-ST, VoxPopuli, Multilingual LibriSpeech, Common Voice v7 and CCMatrix
19
+ - Speech synthesis with [facebook/tts_transformer-es-css10](https://huggingface.co/facebook/fastspeech2-en-ljspeech)
20
+
21
+ ## Usage
22
+ ```python
23
+ from fairseq.checkpoint_utils import load_model_ensemble_and_task_from_hf_hub
24
+ from fairseq.models.text_to_speech.hub_interface import S2THubInterface
25
+ from fairseq.models.text_to_speech.hub_interface import TTSHubInterface
26
+ import IPython.display as ipd
27
+ import torchaudio
28
+
29
+
30
+ models, cfg, task = load_model_ensemble_and_task_from_hf_hub(
31
+ "facebook/xm_transformer_600m-en_es-multi_domain",
32
+ arg_overrides={"config_yaml": "config.yaml"},
33
+ )
34
+ model = models[0]
35
+ generator = task.build_generator(model, cfg)
36
+
37
+
38
+ # requires 16000Hz mono channel audio
39
+ audio, _ = torchaudio.load("/path/to/an/audio/file")
40
+
41
+ sample = S2THubInterface.get_model_input(task, audio)
42
+ text = S2THubInterface.get_prediction(task, model, generator, sample)
43
+
44
+ # speech synthesis
45
+ tts_models, tts_cfg, tts_task = load_model_ensemble_and_task_from_hf_hub(
46
+ f"facebook/tts_transformer-es-css10",
47
+ arg_overrides={"vocoder": "griffin_lim", "fp16": False},
48
+ )
49
+ tts_model = tts_models[0]
50
+ TTSHubInterface.update_cfg_with_data_cfg(tts_cfg, tts_task.data_cfg)
51
+ tts_generator = tts_task.build_generator([tts_model], tts_cfg)
52
+
53
+ tts_sample = TTSHubInterface.get_model_input(tts_task, text)
54
+ wav, sr = TTSHubInterface.get_prediction(
55
+ tts_task, tts_model, tts_generator, tts_sample
56
+ )
57
+
58
+ ipd.Audio(wav, rate=rate)
59
+ ```
60
+
61
+ ## Citation
62
+ ```bibtex
63
+ @inproceedings{li-etal-2021-multilingual,
64
+ title = "Multilingual Speech Translation from Efficient Finetuning of Pretrained Models",
65
+ author = "Li, Xian and
66
+ Wang, Changhan and
67
+ Tang, Yun and
68
+ Tran, Chau and
69
+ Tang, Yuqing and
70
+ Pino, Juan and
71
+ Baevski, Alexei and
72
+ Conneau, Alexis and
73
+ Auli, Michael",
74
+ booktitle = "Proceedings of the 59th Annual Meeting of the Association for Computational Linguistics and the 11th International Joint Conference on Natural Language Processing (Volume 1: Long Papers)",
75
+ month = aug,
76
+ year = "2021",
77
+ address = "Online",
78
+ publisher = "Association for Computational Linguistics",
79
+ url = "https://aclanthology.org/2021.acl-long.68",
80
+ doi = "10.18653/v1/2021.acl-long.68",
81
+ pages = "827--838",
82
+ }
83
+
84
+ @inproceedings{wang-etal-2020-fairseq,
85
+ title = "Fairseq {S}2{T}: Fast Speech-to-Text Modeling with Fairseq",
86
+ author = "Wang, Changhan and
87
+ Tang, Yun and
88
+ Ma, Xutai and
89
+ Wu, Anne and
90
+ Okhonko, Dmytro and
91
+ Pino, Juan",
92
+ booktitle = "Proceedings of the 1st Conference of the Asia-Pacific Chapter of the Association for Computational Linguistics and the 10th International Joint Conference on Natural Language Processing: System Demonstrations",
93
+ month = dec,
94
+ year = "2020",
95
+ address = "Suzhou, China",
96
+ publisher = "Association for Computational Linguistics",
97
+ url = "https://aclanthology.org/2020.aacl-demo.6",
98
+ pages = "33--39",
99
+ }
100
+ ```