class_docstr: A ready-to-use wrapper for Zero-Shot Multi-Speaker Tacotron2.
  For voice cloning: (text, reference_audio) -> (mel_spec).
  For generating a random speaker voice: (text) -> (mel_spec).
  
  
  Example
  -------
  >>> tmpdir_tts = getfixture('tmpdir') / "tts"
  >>> mstacotron2 = MSTacotron2.from_hparams(source="speechbrain/tts-mstacotron2-libritts", savedir=tmpdir_tts) # doctest: +SKIP
  >>> # Sample rate of the reference audio must be greater or equal to the sample rate of the speaker embedding model
  >>> reference_audio_path = "tests/samples/single-mic/example1.wav"
  >>> input_text = "Mary had a little lamb."
  >>> mel_output, mel_length, alignment = mstacotron2.clone_voice(input_text, reference_audio_path) # doctest: +SKIP
  >>> # One can combine the TTS model with a vocoder (that generates the final waveform)
  >>> # Intialize the Vocoder (HiFIGAN)
  >>> tmpdir_vocoder = getfixture('tmpdir') / "vocoder"
  >>> from speechbrain.inference.vocoders import HIFIGAN
  >>> hifi_gan = HIFIGAN.from_hparams(source="speechbrain/tts-hifigan-libritts-22050Hz", savedir=tmpdir_vocoder) # doctest: +SKIP
  >>> # Running the TTS
  >>> mel_output, mel_length, alignment = mstacotron2.clone_voice(input_text, reference_audio_path) # doctest: +SKIP
  >>> # Running Vocoder (spectrogram-to-waveform)
  >>> waveforms = hifi_gan.decode_batch(mel_output) # doctest: +SKIP
  >>> # For generating a random speaker voice, use the following
  >>> mel_output, mel_length, alignment = mstacotron2.generate_random_voice(input_text) # doctest: +SKIP
code: def __init__(self, *args, **kwargs):
      super().__init__(*args, **kwargs)
      self.text_cleaners = ["english_cleaners"]
      self.infer = self.hparams.model.infer
      self.custom_mel_spec_encoder = (
          self.hparams.custom_mel_spec_encoder
      )
  
      self.g2p = GraphemeToPhoneme.from_hparams(
          self.hparams.g2p, run_opts={"device": self.device}
      )
  
      self.spk_emb_encoder = None
      if self.custom_mel_spec_encoder:
          self.spk_emb_encoder = MelSpectrogramEncoder.from_hparams(
              source=self.hparams.spk_emb_encoder,
              run_opts={"device": self.device},
          )
      else:
          self.spk_emb_encoder = EncoderClassifier.from_hparams(
              source=self.hparams.spk_emb_encoder,
              run_opts={"device": self.device},
          )
  
imports: import re
  import logging
  import torch
  import torchaudio
  import random
  import speechbrain
  from speechbrain.utils.fetching import fetch
  from speechbrain.inference.interfaces import Pretrained
  from speechbrain.utils.text_to_sequence import text_to_sequence
  from speechbrain.inference.text import GraphemeToPhoneme
  from speechbrain.inference.encoders import MelSpectrogramEncoder
  from speechbrain.inference.classifiers import EncoderClassifier
label_desc: Use image node_id 1 to create a new MSTacotron2 object from inherited base classes: Pretrained with example: obj = MSTacotron2()