class_docstr: Tacotron 2 Model that is used to generate mel spectrograms from text
code: def _setup_tokenizer(self, cfg):
      text_tokenizer_kwargs = {}
      if (
          "g2p" in cfg.text_tokenizer
          and cfg.text_tokenizer.g2p is not None
      ):
          # for backward compatibility
          if (
              self._is_model_being_restored()
              and (
                  cfg.text_tokenizer.g2p.get("_target_", None)
                  is not None
              )
              and cfg.text_tokenizer.g2p["_target_"].startswith(
                  "nemo_text_processing.g2p"
              )
          ):
              cfg.text_tokenizer.g2p[
                  "_target_"
              ] = g2p_backward_compatible_support(
                  cfg.text_tokenizer.g2p["_target_"]
              )
  
          g2p_kwargs = {}
  
          if "phoneme_dict" in cfg.text_tokenizer.g2p:
              g2p_kwargs["phoneme_dict"] = self.register_artifact(
                  "text_tokenizer.g2p.phoneme_dict",
                  cfg.text_tokenizer.g2p.phoneme_dict,
              )
  
          if "heteronyms" in cfg.text_tokenizer.g2p:
              g2p_kwargs["heteronyms"] = self.register_artifact(
                  "text_tokenizer.g2p.heteronyms",
                  cfg.text_tokenizer.g2p.heteronyms,
              )
  
          text_tokenizer_kwargs["g2p"] = instantiate(
              cfg.text_tokenizer.g2p, **g2p_kwargs
          )
  
      self.tokenizer = instantiate(
          cfg.text_tokenizer, **text_tokenizer_kwargs
      )
  
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 12 for calling the Tacotron2Model obj's underlying member method code with example usage: obj._setup_tokenizer(cfg) without return types