class_docstr: Cross-lingual BERT dataset similar to the translation-language modeling objective in the XLM paper (https://arxiv.org/abs/1901.07291)
code: def __getitem__(self, idx):
      src, tgt = super()._get_sample(idx)
      if len(src) > self.max_src_seq_length:
          src = src[: self.max_src_seq_length]
  
      if (
          len(tgt) > self.max_tgt_seq_length - 1
      ):  # -1 here to account for the <sep> token that gets added.
          tgt = tgt[: self.max_tgt_seq_length]
  
      np_rng = np.random.RandomState(seed=((self.seed + idx) % 2**32))
      # Potentially swap src, tgt with a 50% chance to avoid learning associations based on position in the sequence.
      swap_src_tgt = np_rng.randint(0, 2)
      if swap_src_tgt == 0:
          sample = [np.concatenate((src, [self.sep_id], tgt))]
      elif swap_src_tgt == 1:
          sample = [np.concatenate((tgt, [self.sep_id], src))]
  
      return build_training_sample_bert(
          sample=sample,
          target_seq_length=sample[0].shape[0],
          max_seq_length=self.max_seq_length,  # needed for padding
          vocab_id_list=self.vocab_id_list,
          vocab_id_to_token_dict=self.vocab_id_to_token_dict,
          cls_id=self.cls_id,
          sep_id=self.sep_id,
          mask_id=self.mask_id,
          pad_id=self.pad_id,
          masked_lm_prob=self.masked_lm_prob,
          np_rng=np_rng,
          binary_head=False,
          whole_word_masking=False,
          skip_masking_id=self.sep_id,
      )
  
imports: from typing import Dict, List
  import numpy
  from nemo.collections.common.tokenizers.tokenizer_spec import TokenizerSpec
  from nemo.collections.nlp.data.common.sequence_to_sequence_dataset import BinarizedMemmapSequenceToSequenceDataset, TextMemmapSequenceToSequenceDataset
  from nemo.collections.nlp.data.language_modeling.megatron.bert_dataset import build_training_sample
  from nemo.collections.nlp.data.language_modeling.megatron.length_distribution_type import LengthDistribution
  from nemo.collections.nlp.data.language_modeling.megatron.t5_dataset import T5Dataset
  from nemo.collections.nlp.data.language_modeling.megatron.ul2_dataset import UL2Dataset
label_desc: Use image node_id 2 for calling the CrossLingualBERTDataset obj's underlying member method code with example usage: obj.__getitem__(idx) and returns: build_training_sample_bert