code: def _setup_tokenizer(self, cfg):
      text_tokenizer_kwargs = {}
      if "g2p" in cfg.text_tokenizer:
          # 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
      )
      if isinstance(self.tokenizer, BaseTokenizer):
          self.text_tokenizer_pad_id = self.tokenizer.pad
          self.tokens = self.tokenizer.tokens
      else:
          if text_tokenizer_pad_id is None:
              raise ValueError(
                  f"text_tokenizer_pad_id must be specified if text_tokenizer is not BaseTokenizer"
              )
  
          if tokens is None:
              raise ValueError(
                  f"tokens must be specified if text_tokenizer is not BaseTokenizer"
              )
  
          self.text_tokenizer_pad_id = text_tokenizer_pad_id
          self.tokens = tokens
  
imports: import contextlib
  import torch
  from hydra.utils import instantiate
  from omegaconf import DictConfig, OmegaConf
  from pytorch_lightning import Trainer
  from pytorch_lightning.loggers import TensorBoardLogger
  from nemo.collections.common.tokenizers.text_to_speech.tts_tokenizers import BaseTokenizer
  from nemo.collections.tts.losses.radttsloss import AttentionBinarizationLoss, RADTTSLoss
  from nemo.collections.tts.models.base import SpectrogramGenerator
  from nemo.collections.tts.parts.utils.helpers import batch_from_ragged, g2p_backward_compatible_support, plot_alignment_to_numpy, regulate_len, sample_tts_input
  from nemo.core.classes import Exportable
  from nemo.core.classes.common import typecheck
  from nemo.core.neural_types.elements import Index, MelSpectrogramType, RegressionValuesType, TokenDurationType, TokenIndex
  from nemo.core.neural_types.neural_type import NeuralType
  from nemo.core.optim.radam import RAdam
  from nemo.utils import logging
  from nemo.utils.decorators import experimental
label_desc: Use image node_id 13 for calling the RadTTSModel obj's underlying member method code with example usage: obj._setup_tokenizer(cfg) without return types