Changhan commited on
Commit
e129106
1 Parent(s): ea70305

Update README.md

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