From 9646624cd5304c215f4b1563bfb1001da91d59de Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Eren=20G=C3=B6lge?= Date: Fri, 29 Jan 2021 15:17:29 +0000 Subject: [PATCH] docstring hubconf --- hubconf.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hubconf.py b/hubconf.py index c4e5bc99..0e2e60d8 100644 --- a/hubconf.py +++ b/hubconf.py @@ -8,8 +8,22 @@ from TTS.utils.synthesizer import Synthesizer from TTS.utils.manage import ModelManager +def tts(model_name='tts_models/en/ljspeech/tacotron2-DCA', vocoder_name='vocoder_models/en/ljspeech/mulitband-melgan'): + """TTS entry point for PyTorch Hub that provides a Synthesizer object to synthesize speech from a give text. -def tts(model_name='tts_models/en/ljspeech/tacotron2-DCA', vocoder_name='vocoder_models/en/ljspeech/mulitband-melgan', pretrained=True): + Example: + >>> synthesizer = torch.hub.load('mozilla/TTS', 'tts', source='github') + >>> wavs = synthesizer.tts("This is a test! This is also a test!!") + wavs - is a list of values of the synthesized speech. + + Args: + model_name (str, optional): One of the model names from .model.json. Defaults to 'tts_models/en/ljspeech/tacotron2-DCA'. + vocoder_name (str, optional): One of the model names from .model.json. Defaults to 'vocoder_models/en/ljspeech/mulitband-melgan'. + pretrained (bool, optional): [description]. Defaults to True. + + Returns: + TTS.utils.synthesizer.Synthesizer: Synthesizer object wrapping both vocoder and tts models. + """ manager = ModelManager() model_path, config_path = manager.download_model(model_name) @@ -21,6 +35,5 @@ def tts(model_name='tts_models/en/ljspeech/tacotron2-DCA', vocoder_name='vocoder if __name__ == '__main__': - # synthesizer = torch.hub.load('/data/rw/home/projects/TTS/TTS', 'tts', source='local') synthesizer = torch.hub.load('mozilla/TTS:hub_conf', 'tts', source='github') synthesizer.tts("This is a test!") \ No newline at end of file