Source code for espnet2.s2st.synthesizer.abs_synthesizer

# Copyright 2021 Tomoki Hayashi
# Copyright 2022 Carnegie Mellon University (Jiatong Shi)
#  Apache 2.0  (

"""Text-to-speech abstrast class."""

from abc import ABC, abstractmethod
from typing import Dict, Tuple

import torch

[docs]class AbsSynthesizer(torch.nn.Module, ABC): """TTS abstract class."""
[docs] @abstractmethod def forward( self, input_states: torch.Tensor, input_states_lengths: torch.Tensor, feats: torch.Tensor, feats_lengths: torch.Tensor, **kwargs, ) -> Tuple[torch.Tensor, Dict[str, torch.Tensor], torch.Tensor]: """Calculate outputs and return the loss tensor.""" raise NotImplementedError
[docs] @abstractmethod def inference( self, input_states: torch.Tensor, **kwargs, ) -> Dict[str, torch.Tensor]: """Return predicted output as a dict.""" raise NotImplementedError
@property def require_raw_speech(self): """Return whether or not raw_speech is required.""" return False @property def require_vocoder(self): """Return whether or not vocoder is required.""" return True