class_docstr: Megatron T5 pretraining
class_docstr_tok: ["Megatron","T5","pretraining"]
code: def _add_base_special_tokens(
      cls, tokenizer, is_huggingface_converted_model
  ):
      # Need to add cls, sep, mask tokens to the tokenizer if they don't exist.
      # If cls, sep and mask are not attributes of the tokenizer, add it.
      if not hasattr(tokenizer, "cls_token"):
          tokenizer.add_special_tokens({"cls_token": "<cls>"})
      if not hasattr(tokenizer.tokenizer, "sep_id"):
          tokenizer.add_special_tokens({"sep_token": "<sep>"})
      if not hasattr(tokenizer.tokenizer, "mask_id"):
          tokenizer.add_special_tokens({"mask_token": "<mask>"})
  
      # bos, eos, pad and unk may be present in the provided spm .model file, if they are, use it.
      if not hasattr(tokenizer, "pad_token"):
          # TODO: Figure out how to do backward compat with pad_id > 0 and >= 0.
          if is_huggingface_converted_model:
              if (
                  hasattr(tokenizer.tokenizer, "pad_id")
                  and tokenizer.tokenizer.pad_id() >= 0
              ):
                  tokenizer.pad_token = tokenizer.tokenizer.id_to_piece(
                      tokenizer.tokenizer.pad_id()
                  )
              else:
                  tokenizer.add_special_tokens({"pad_token": "<pad>"})
          else:
              if (
                  hasattr(tokenizer.tokenizer, "pad_id")
                  and tokenizer.tokenizer.pad_id() > 0
              ):
                  tokenizer.pad_token = tokenizer.tokenizer.id_to_piece(
                      tokenizer.tokenizer.pad_id()
                  )
              else:
                  tokenizer.add_special_tokens({"pad_token": "<pad>"})
      else:
          tokenizer.add_special_tokens({"pad_token": "<pad>"})
  
      if not hasattr(tokenizer, "bos_token"):
          if (
              hasattr(tokenizer.tokenizer, "bos_id")
              and tokenizer.tokenizer.bos_id() > 0
          ):
              tokenizer.bos_token = tokenizer.tokenizer.id_to_piece(
                  tokenizer.tokenizer.bos_id()
              )
          else:
              tokenizer.add_special_tokens({"bos_token": "<bos>"})
      else:
          tokenizer.add_special_tokens({"bos_token": "<s>"})
  
      if not hasattr(tokenizer, "eos_token"):
          if (
              hasattr(tokenizer.tokenizer, "eos_id")
              and tokenizer.tokenizer.eos_id() > 0
          ):
              tokenizer.eos_token = tokenizer.tokenizer.id_to_piece(
                  tokenizer.tokenizer.eos_id()
              )
          else:
              tokenizer.add_special_tokens({"eos_token": "<eos>"})
      else:
          tokenizer.add_special_tokens({"eos_token": "</s>"})
  
imports: import enum
  import math
  from omegaconf.dictconfig import DictConfig
  from pytorch_lightning.trainer.trainer import Trainer
  from nemo.collections.nlp.data.language_modeling.megatron.dataset_utils import build_train_valid_test_datasets
  from nemo.collections.nlp.models.language_modeling.megatron_lm_encoder_decoder_model import MegatronLMEncoderDecoderModel
  from nemo.utils import logging
label_desc: Use image node_id 7 for calling the MegatronT5Model obj's underlying member method code with example usage: obj._add_base_special_tokens(cls, tokenizer, is_huggingface_converted_model) without return types