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: Computes mel-spectrogram for a list of phoneme sequences
  
  Arguments
  ---------
  phonemes: List[List[str]]
      phonemes 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
  
  Returns
  -------
  tensors of output spectrograms, output lengths and alignments
docstr_tok: ["Computes","mel-spectrogram","for","a","list","of","phoneme","sequences","Arguments","--","--","--","--","-","phonemes",":","List","[","List","[","str","]","]","phonemes","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","Returns","--","--","--","-","tensors","of","output","spectrograms",",","output","lengths","and","alignments"]
code: def encode_phoneme(
      self, phonemes, pace=1.0, pitch_rate=1.0, energy_rate=1.0
  ):
      """Computes mel-spectrogram for a list of phoneme sequences
  
      Arguments
      ---------
      phonemes: List[List[str]]
          phonemes 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
  
      Returns
      -------
      tensors of output spectrograms, output lengths and alignments
      """
  
      all_tokens = []
      max_seq_len = -1
      for phoneme in phonemes:
          token_seq = (
              self.input_encoder.encode_sequence_torch(phoneme)
              .int()
              .to(self.device)
          )
          if max_seq_len < token_seq.shape[-1]:
              max_seq_len = token_seq.shape[-1]
          all_tokens.append(token_seq)
  
      tokens_padded = torch.LongTensor(len(phonemes), max_seq_len).to(
          self.device
      )
      tokens_padded.zero_()
  
      for seq_idx, seq in enumerate(all_tokens):
          tokens_padded[seq_idx, : len(seq)] = seq
  
      return self.encode_batch(
          tokens_padded,
          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 4 for calling the FastSpeech2InternalAlignment obj's underlying member method code with example usage: obj.encode_phoneme(phonemes, pace, pitch_rate, energy_rate) and returns: self