audio icon indicating copy to clipboard operation
audio copied to clipboard

Make TextProcessor object inherit `torch.nn.Module`.

Open mthrok opened this issue 4 years ago • 0 comments

The TextProcessor object from TTS pipeline, should be able to return Tensors in specified device.

Currently the returned Tensors have to be manually moved to the target device.

bundle = torchaudio.pipelines.TACOTRON2_WAVERNN_PHONE_LJSPEECH
processor = bundle.get_text_processor()

text = "Hello world! Text to speech!"
processed, lengths = processor(text)
processed = processed.to(device)
lengths = lengths.to(device)

Inheriting torch.nn.Module should make this simpler

bundle = torchaudio.pipelines.TACOTRON2_WAVERNN_PHONE_LJSPEECH
processor = bundle.get_text_processor().to(device)

text = "Hello world! Text to speech!"
processed, lengths = processor(text)

mthrok avatar Oct 19 '21 16:10 mthrok