class_docstr: A ready-to-use wrapper for Tacotron2 (text -> mel_spec).
  
  Arguments
  ---------
  hparams
      Hyperparameters (from HyperPyYAML)
  
  Example
  -------
  >>> tmpdir_tts = getfixture('tmpdir') / "tts"
  >>> tacotron2 = Tacotron2.from_hparams(source="speechbrain/tts-tacotron2-ljspeech", savedir=tmpdir_tts)
  >>> mel_output, mel_length, alignment = tacotron2.encode_text("Mary had a little lamb")
  >>> items = [
  ...   "A quick brown fox jumped over the lazy dog",
  ...   "How much wood would a woodchuck chuck?",
  ...   "Never odd or even"
  ... ]
  >>> mel_outputs, mel_lengths, alignments = tacotron2.encode_batch(items)
  
  >>> # 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-ljspeech", savedir=tmpdir_vocoder)
  >>> # Running the TTS
  >>> mel_output, mel_length, alignment = tacotron2.encode_text("Mary had a little lamb")
  >>> # Running Vocoder (spectrogram-to-waveform)
  >>> waveforms = hifi_gan.decode_batch(mel_output)
docstr: Encodes raw text into a tensor with a customer text-to-sequence function
docstr_tok: ["Encodes","raw","text","into","a","tensor","with","a","customer","text-to-sequence","function"]
code: def text_to_seq(self, txt):
      """Encodes raw text into a tensor with a customer text-to-sequence function"""
      sequence = self.hparams.text_to_sequence(txt, self.text_cleaners)
      return sequence, len(sequence)
  
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 2 for calling the Tacotron2 obj's underlying member method code with example usage: obj.text_to_seq(txt) and returns: sequence,  len