class_docstr: Tacotron 2 Model that is used to generate mel spectrograms from text
code: def parse(self, text: str, normalize=True) -> torch.Tensor:
      if self.training:
          logging.warning("parse() is meant to be called in eval mode.")
      if normalize and self.text_normalizer_call is not None:
          text = self.text_normalizer_call(
              text, **self.text_normalizer_call_kwargs
          )
  
      eval_phon_mode = contextlib.nullcontext()
      if hasattr(self.tokenizer, "set_phone_prob"):
          eval_phon_mode = self.tokenizer.set_phone_prob(prob=1.0)
  
      with eval_phon_mode:
          if self.tokenizer is not None:
              tokens = self.tokenizer.encode(text)
          else:
              tokens = self.parser(text)
              # Old parser doesn't add bos and eos ids, so maunally add it
              tokens = (
                  [len(self._cfg.labels)]
                  + tokens
                  + [len(self._cfg.labels) + 1]
              )
      tokens_tensor = torch.tensor(tokens).unsqueeze_(0).to(self.device)
      return tokens_tensor
  
imports: import contextlib
  from dataclasses import dataclass, field
  from typing import Any, Dict, List, Optional
  import torch
  from hydra.utils import instantiate
  from omegaconf import MISSING, DictConfig, OmegaConf, open_dict
  from omegaconf.errors import ConfigAttributeError
  from pytorch_lightning.loggers import TensorBoardLogger, WandbLogger
  from torch import nn
  from nemo.collections.common.parts.preprocessing import parsers
  from nemo.collections.tts.losses.tacotron2loss import Tacotron2Loss
  from nemo.collections.tts.models.base import SpectrogramGenerator
  from nemo.collections.tts.parts.utils.helpers import g2p_backward_compatible_support, get_mask_from_lengths, tacotron2_log_to_tb_func, tacotron2_log_to_wandb_func
  from nemo.core.classes.common import PretrainedModelInfo, typecheck
  from nemo.core.neural_types.elements import AudioSignal, EmbeddedTextType, LengthsType, LogitsType, MelSpectrogramType, SequenceToSequenceAlignmentType
  from nemo.core.neural_types.neural_type import NeuralType
  from nemo.utils import logging, model_utils
label_desc: Use image node_id 3 for calling the Tacotron2Model obj's underlying member method code with example usage: obj.parse(text, normalize) and returns: tokens_tensor