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
  import omegaconf
  import torch
  from hydra.utils import instantiate
  from omegaconf import DictConfig, OmegaConf
  from pytorch_lightning import Trainer
  from pytorch_lightning.loggers import WandbLogger
  from torch.cuda.amp import autocast
  from torch.nn import functional
  from nemo.collections.tts.data.dataset import DistributedBucketSampler
  from nemo.collections.tts.losses.vits_losses import DiscriminatorLoss, FeatureMatchingLoss, GeneratorLoss, KlLoss
  from nemo.collections.tts.models.base import TextToWaveform
  from nemo.collections.tts.modules.vits_modules import MultiPeriodDiscriminator
  from nemo.collections.tts.parts.utils.helpers import clip_grad_value_, g2p_backward_compatible_support, plot_spectrogram_to_numpy, slice_segments
  from nemo.collections.tts.torch.tts_data_types import SpeakerID
  from nemo.core.classes.common import PretrainedModelInfo, typecheck
  from nemo.core.neural_types.elements import AudioSignal, FloatType, Index, IntType, TokenIndex
  from nemo.core.neural_types.neural_type import NeuralType
  from nemo.core.optim.lr_scheduler import CosineAnnealing
  from nemo.utils import logging, model_utils
  from nemo.utils.decorators.experimental import experimental
label_desc: Use image node_id 3 for calling the VitsModel obj's underlying member method code with example usage: obj._setup_tokenizer(cfg) without return types