class_docstr: Megatron T5 pretraining
class_docstr_tok: ["Megatron","T5","pretraining"]
code: def _add_sentinel_tokens(
      cls,
      tokenizer,
      num_sentinel_tokens,
      add_sentinel_tokens_in_reverse_order,
  ):
      # Special check to see if <extra_id_{}> is already present in the tokenizer. If it is, only modify the additional_special_tokens function.
      for i in range(num_sentinel_tokens):
          if add_sentinel_tokens_in_reverse_order:
              i = num_sentinel_tokens - i - 1
          if len(tokenizer.text_to_ids(f"<extra_id_{i}>")) == 1:
              tokenizer.special_token_to_id[
                  f"<extra_id_{i}>"
              ] = tokenizer.text_to_ids(f"<extra_id_{i}>")[0]
          else:
              tokenizer.add_special_tokens([f"<extra_id_{i}>"])
  
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 6 for calling the MegatronT5Model obj's underlying member method code with example usage: obj._add_sentinel_tokens(cls, tokenizer, num_sentinel_tokens, add_sentinel_tokens_in_reverse_order) without return types