File: tacotron2_pipeline_test.py

package info (click to toggle)
pytorch-audio 2.6.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 10,696 kB
  • sloc: python: 61,274; cpp: 10,031; sh: 128; ansic: 70; makefile: 34
file content (28 lines) | stat: -rw-r--r-- 819 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import pytest
from torchaudio.pipelines import (
    TACOTRON2_GRIFFINLIM_CHAR_LJSPEECH,
    TACOTRON2_GRIFFINLIM_PHONE_LJSPEECH,
    TACOTRON2_WAVERNN_CHAR_LJSPEECH,
    TACOTRON2_WAVERNN_PHONE_LJSPEECH,
)


@pytest.mark.parametrize(
    "bundle",
    [
        TACOTRON2_GRIFFINLIM_CHAR_LJSPEECH,
        TACOTRON2_GRIFFINLIM_PHONE_LJSPEECH,
        TACOTRON2_WAVERNN_CHAR_LJSPEECH,
        TACOTRON2_WAVERNN_PHONE_LJSPEECH,
    ],
)
def test_tts_models(bundle):
    """Smoke test of TTS pipeline"""
    text = "Hello world! Text to Speech!"

    processor = bundle.get_text_processor()
    tacotron2 = bundle.get_tacotron2()
    vocoder = bundle.get_vocoder()
    processed, lengths = processor(text)
    mel_spec, lengths, _ = tacotron2.infer(processed, lengths)
    waveforms, lengths = vocoder(mel_spec, lengths)