class_docstr: A ready-to-use wrapper for Fastspeech2 with internal alignment(text -> mel_spec).
  Arguments
  ---------
  hparams
      Hyperparameters (from HyperPyYAML)
  Example
  -------
  >>> tmpdir_tts = getfixture('tmpdir') / "tts"
  >>> fastspeech2 = FastSpeech2InternalAlignment.from_hparams(source="speechbrain/tts-fastspeech2-internal-alignment-ljspeech", savedir=tmpdir_tts) # doctest: +SKIP
  >>> mel_outputs, durations, pitch, energy = fastspeech2.encode_text(["Mary had a little lamb."]) # doctest: +SKIP
  >>> items = [
  ...   "A quick brown fox jumped over the lazy dog",
  ...   "How much wood would a woodchuck chuck?",
  ...   "Never odd or even"
  ... ]
  >>> mel_outputs, durations, pitch, energy = fastspeech2.encode_text(items) # 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-ljspeech", savedir=tmpdir_vocoder) # doctest: +SKIP
  >>> # Running the TTS
  >>> mel_outputs, durations, pitch, energy = fastspeech2.encode_text(["Mary had a little lamb."]) # doctest: +SKIP
  >>> # Running Vocoder (spectrogram-to-waveform)
  >>> waveforms = hifi_gan.decode_batch(mel_outputs) # doctest: +SKIP
docstr: Batch inference for a tensor of phoneme sequences
  Arguments
  ---------
  text : str
      A text to be converted to spectrogram
  pace : float
      pace for the speech synthesis
  pitch_rate : float
      scaling factor for phoneme pitches
  energy_rate : float
      scaling factor for phoneme energies
docstr_tok: ["Batch","inference","for","a","tensor","of","phoneme","sequences","Arguments","--","--","--","--","-","text",":","str","A","text","to","be","converted","to","spectrogram","pace",":","float","pace","for","the","speech","synthesis","pitch_rate",":","float","scaling","factor","for","phoneme","pitches","energy_rate",":","float","scaling","factor","for","phoneme","energies"]
code: def forward(self, text, pace=1.0, pitch_rate=1.0, energy_rate=1.0):
      """Batch inference for a tensor of phoneme sequences
      Arguments
      ---------
      text : str
          A text to be converted to spectrogram
      pace : float
          pace for the speech synthesis
      pitch_rate : float
          scaling factor for phoneme pitches
      energy_rate : float
          scaling factor for phoneme energies
      """
      return self.encode_text(
          [text],
          pace=pace,
          pitch_rate=pitch_rate,
          energy_rate=energy_rate,
      )
  
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 6 for calling the FastSpeech2InternalAlignment obj's underlying member method code with example usage: obj.forward(text, pace, pitch_rate, energy_rate) and returns: self