Changhan commited on
Commit
f4bceab
1 Parent(s): 5cd82a1

Update README.md

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