code: def __getitem__(self, idx):
      np_rng = np.random.RandomState(seed=(self.seed + idx))
  
      sample, seq_length = self._get_sample(idx)
  
      # flatten sentences into one list
      tokens = [token for sentence in sample for token in sentence]
  
      # Truncate to `target_sequence_length`.
      max_num_tokens = seq_length
      tokens = tokens[:max_num_tokens]
  
      # Masking.
      max_predictions_per_seq = self.masked_lm_prob * max_num_tokens
  
      lm_pred = create_masked_lm_predictions(
          tokens=tokens,
          vocab_id_list=self.vocab_id_list,
          vocab_id_to_token_dict=self.vocab_id_to_token_dict,
          masked_lm_prob=self.masked_lm_prob,
          cls_id=self.cls_id,
          sep_id=self.sep_id,
          mask_id=self.mask_id,
          max_predictions_per_seq=max_predictions_per_seq,
          np_rng=np_rng,
          max_ngram_size=self.max_ngram_size,
          whole_word_masking=self.whole_word_masking,
          favor_long_ngrams=self.favor_long_ngrams,
          mean_ngram_size=self.mean_ngram_size,
          permutation=self.permutation,
          geometric_dist=self.geometric_dist,
          masking_style="t5",
          tokenizer_type=self.tokenizer_type,
      )
  
      if self.masked_lm_prob == 0:
          (output_tokens, masked_positions, masked_labels, _) = lm_pred
          masked_spans = None
      else:
          (
              output_tokens,
              masked_positions,
              masked_labels,
              _,
              masked_spans,
          ) = lm_pred
  
      # Padding.
      (
          tokens_enc,
          tokens_dec_in,
          labels,
          enc_mask,
          dec_mask,
          loss_mask,
      ) = self.pad_and_convert_to_numpy(
          tokens=tokens,
          output_tokens=output_tokens,
          masked_positions=masked_positions,
          masked_labels=masked_labels,
          masked_spans=masked_spans,
          np_rng=np_rng,
      )
  
      train_sample = {
          "text_enc": tokens_enc,
          "text_dec": tokens_dec_in,
          "labels": labels,
          "loss_mask": loss_mask,
          "enc_mask": enc_mask,
          "dec_mask": dec_mask,
      }
  
      return train_sample
  
file_path: NeMo/nemo/collections/nlp/data/language_modeling/megatron/bart_dataset.py
imports: import numpy
  from nemo.collections.nlp.data.language_modeling.megatron.dataset_utils import create_masked_lm_predictions, get_samples_mapping
  from nemo.collections.nlp.data.language_modeling.megatron.t5_dataset import T5Dataset
label_desc: Use image node_id 3 for calling the BARTDataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: train_sample