class_docstr: UL2 Dataset from https://arxiv.org/abs/2205.05131.
  Consists of three different objectives:
  1. Short span masking with small probabilities (ex: T5). Typically max ngram size of 5 with 0.15 mask prob.
  2. Extreme span masking with either large probabilities or large ngram sizes or both.
  3. Prefx-LM as in the T5 or LM-adapted T5 (prompt-tuning paper).
class_docstr_tok: ["UL2","Dataset","from","https",":","\/\/arxiv.org\/abs\/2205.05131",".","Consists","of","three","different","objectives",":","1",".","Short","span","masking","with","small","probabilities","(","ex",":","T5",")",".","Typically","max","ngram","size","of","5","with","0.15","mask","prob",".","2",".","Extreme","span","masking","with","either","large","probabilities","or","large","ngram","sizes","or","both",".","3",".","Prefx-LM","as","in","the","T5","or","LM-adapted","T5","(","prompt-tuning","paper",")","."]
code: def __getitem__(self, idx):
      sample, seq_length = self._get_sample(idx)
      # Note that this rng state should be numpy and not python since
      # python randint is inclusive whereas the numpy one is exclusive.
      np_rng = np.random.RandomState(seed=(self.seed + idx))
      masking_type = np_rng.randint(
          0, 3
      )  # 0: short span masking, 1: extreme masking, 2: prefix-LM
      if masking_type == 0:
          # Call T5's build training sample for regular short span masking.
          return UL2Dataset.get_r_masking_training_sample(
              sample=sample,
              tokenizer=self.tokenizer,
              np_rng=np_rng,
              target_seq_length=seq_length,
              max_seq_length=self.max_seq_length,
              max_seq_length_dec=self.max_seq_length_dec,
              masked_lm_prob=self.masked_lm_prob,
              vocab_id_list=self.vocab_id_list,
              vocab_id_to_token_dict=self.vocab_id_to_token_dict,
              max_ngram_size=self.max_ngram_size,
              mean_ngram_size=self.mean_ngram_size,
              whole_word_masking=self.whole_word_masking,
              favor_long_ngrams=self.favor_long_ngrams,
              permutation=self.permutation,
              geometric_dist=self.geometric_dist,
              tokenizer_type=self.tokenizer_type,
              sentinel_tokens=self.sentinel_tokens,
              skip_masking_id=None,
          )
      elif masking_type == 1:
          return UL2Dataset.get_x_masking_training_sample(
              sample=sample,
              tokenizer=self.tokenizer,
              np_rng=np_rng,
              target_seq_length=seq_length,
              max_seq_length=self.max_seq_length,
              max_seq_length_dec=self.max_seq_length_dec,
              masked_lm_prob=self.masked_lm_prob,
              extreme_masked_lm_prob=self.extreme_masked_lm_prob,
              max_ngram_size=self.max_ngram_size,
              min_ngram_size=self.min_ngram_size,
              mean_ngram_size=self.mean_ngram_size,
              extreme_max_ngram_size=self.extreme_max_ngram_size,
              extreme_min_ngram_size=self.extreme_min_ngram_size,
              extreme_mean_ngram_size=self.extreme_mean_ngram_size,
              extreme_ngram_span_length_distribution=self.extreme_ngram_span_length_distribution,
              sentinel_tokens=self.sentinel_tokens,
              skip_masking_id=None,
          )
      elif masking_type == 2:
          return UL2Dataset.get_s_masking_training_sample(
              sample=sample,
              np_rng=np_rng,
              max_seq_length_encoder=self.max_seq_length,
              max_seq_length_decoder=self.max_seq_length_dec,
              tokenizer=self.tokenizer,
              prefix_lm_pivot_mean=self.prefix_lm_pivot_mean,
              pivot_distribution=self.extreme_ngram_span_length_distribution,
          )
  
file_path: NeMo/nemo/collections/nlp/data/language_modeling/megatron/ul2_dataset.py
imports: import numpy
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.collections.nlp.data.language_modeling.megatron.dataset_utils import create_extreme_masked_lm_predictions
  from nemo.collections.nlp.data.language_modeling.megatron.length_distribution_type import LengthDistribution
  from nemo.collections.nlp.data.language_modeling.megatron.lm_adapted_t5_dataset import T5LMAdaptedDataset
  from nemo.collections.nlp.data.language_modeling.megatron.t5_dataset import T5Dataset
label_desc: Use image node_id 5 for calling the UL2Dataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: UL2Dataset, UL2Dataset, UL2Dataset