Skip to content

Commit

Permalink
docstring hubconf
Browse files Browse the repository at this point in the history
  • Loading branch information
erogol committed Mar 8, 2021
1 parent 30c3bef commit 9646624
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions hubconf.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,22 @@
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)
Expand All @@ -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!")

0 comments on commit 9646624

Please sign in to comment.