code: def create_sample(
      cls,
      np_rng: np.random.RandomState,
      src: List[int],
      tgt: List[int],
      sampling_ratios: Dict[str, float],
      max_src_seq_length: int,
      max_tgt_seq_length: int,
      max_seq_length: int,
      max_seq_length_dec: int,
      src_language: str,
      tgt_language: str,
      src_tokenizer: TokenizerSpec,
      tgt_tokenizer: TokenizerSpec,
      sep_id: int,
      masked_lm_prob: float,
      extreme_masked_lm_prob: float,
      max_ngram_size: int,
      min_ngram_size: int,
      mean_ngram_size: int,
      extreme_max_ngram_size: int,
      extreme_min_ngram_size: int,
      extreme_mean_ngram_size: int,
      extreme_ngram_span_length_distribution: LengthDistribution,
      sentinel_tokens: List[int],
      prefix_lm_pivot_mean: float,
      vocab_id_list: List[int],
      vocab_id_to_token_dict: Dict[int, str],
      favor_long_ngrams: bool = False,
      permutation: bool = False,
      geometric_dist: bool = True,
      tokenizer_type: str = "wordpiece",
  ):
      # Determine which task to perform - NMT/T5/UL2 based on sampling ratios.
      task = np_rng.choice(
          list(sampling_ratios.keys()), p=list(sampling_ratios.values())
      )
  
      # 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 len(src) > max_src_seq_length:
          src = src[:max_src_seq_length]
  
      # Tasks that are not NMT have a <sep> token so we need to account for this in the length, hence we truncate tgt to max_tgt_seq_length - 1.
      max_tgt_seq_length = (
          max_tgt_seq_length - 1
          if task != "nmt"
          else max_tgt_seq_length
      )
      if len(tgt) > max_tgt_seq_length:
          tgt = tgt[:max_tgt_seq_length]
  
      if task == "nmt":
          # If src/tgt are swapped, also swap the prepend language token ID.
          if swap_src_tgt == 1:
              src, tgt = tgt, src
              prepend_id = f"<{src_language}>"
          else:
              prepend_id = f"<{tgt_language}>"
  
          text_dec = np.concatenate([[tgt_tokenizer.bos_id], tgt])
          labels = np.concatenate([tgt, [tgt_tokenizer.eos_id]])
          nmt_sample = {
              "text_enc": src,
              "text_dec": text_dec,
              "labels": labels,
          }
          return UL2Dataset._prepend_mask_type_token(
              src_tokenizer, nmt_sample, prepend_id
          )
  
      if swap_src_tgt == 0:
          sample = [np.concatenate((src, [sep_id], tgt))]
      elif swap_src_tgt == 1:
          sample = [np.concatenate((tgt, [sep_id], src))]
  
      if task == "x-masking":
          return UL2Dataset.get_x_masking_training_sample(
              sample=sample,
              tokenizer=src_tokenizer,
              np_rng=np_rng,
              target_seq_length=sample[0].shape[0],
              max_seq_length=max_seq_length,  # -1 to account for the <extra_id_x> token that gets added after the sample is created.
              max_seq_length_dec=max_seq_length_dec,
              masked_lm_prob=masked_lm_prob,
              extreme_masked_lm_prob=extreme_masked_lm_prob,
              max_ngram_size=max_ngram_size,
              min_ngram_size=min_ngram_size,
              mean_ngram_size=mean_ngram_size,
              extreme_max_ngram_size=extreme_max_ngram_size,
              extreme_min_ngram_size=extreme_min_ngram_size,
              extreme_mean_ngram_size=extreme_mean_ngram_size,
              extreme_ngram_span_length_distribution=extreme_ngram_span_length_distribution,
              sentinel_tokens=sentinel_tokens,
              skip_masking_id=sep_id,
          )
      elif task == "s-masking":
          return UL2Dataset.get_s_masking_training_sample(
              sample=sample,
              np_rng=np_rng,
              max_seq_length_encoder=max_seq_length,  # -1 to account for the <extra_id_s> token that gets added after the sample is created.
              max_seq_length_decoder=max_seq_length_dec,
              tokenizer=src_tokenizer,
              prefix_lm_pivot_mean=prefix_lm_pivot_mean,
              pivot_distribution=extreme_ngram_span_length_distribution,
              add_eos=True,  # Most sentences are < max length in cross-lingual data, so we add an EOS to indicate to the model to stop.
          )
      elif task == "r-masking":
          return UL2Dataset.get_r_masking_training_sample(
              sample=sample,
              tokenizer=src_tokenizer,
              np_rng=np_rng,
              target_seq_length=sample[0].shape[0],
              max_seq_length=max_seq_length,  # -1 to account for the <extra_id_r> token that gets added after the sample is created.
              max_seq_length_dec=max_seq_length_dec,
              masked_lm_prob=masked_lm_prob,
              vocab_id_list=vocab_id_list,
              vocab_id_to_token_dict=vocab_id_to_token_dict,
              max_ngram_size=max_ngram_size,
              mean_ngram_size=mean_ngram_size,
              whole_word_masking=False,
              favor_long_ngrams=favor_long_ngrams,
              permutation=permutation,
              geometric_dist=geometric_dist,
              tokenizer_type=tokenizer_type,
              sentinel_tokens=sentinel_tokens,
              skip_masking_id=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 3 for calling the BinarizedMemmapCrossLingualMLMAndTranslationDataset obj's underlying member method code with example usage: obj.create_sample(cls, np_rng, src, tgt, sampling_ratios, max_src_seq_length, max_tgt_seq_length, max_seq_length, max_seq_length_dec, src_language, tgt_language, src_tokenizer, tgt_tokenizer, sep_id, masked_lm_prob, extreme_masked_lm_prob, max_ngram_size, min_ngram_size, mean_ngram_size, extreme_max_ngram_size, extreme_min_ngram_size, extreme_mean_ngram_size, extreme_ngram_span_length_distribution, sentinel_tokens, prefix_lm_pivot_mean, vocab_id_list, vocab_id_to_token_dict, favor_long_ngrams, permutation, geometric_dist, tokenizer_type) and returns: UL2Dataset, UL2Dataset, UL2Dataset, UL2Dataset