Changhan commited on
Commit
fe205a2
1 Parent(s): f1695c8

Update README.md

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