code: def text_to_tokens_mask(self, X, Y=None):
      out_gen = self._text_to_ids(X, pad_token=self.config.pad_token)
  
      for out in out_gen:
          seq_len = out.token_ids.shape[0]
          mlm_mask = np.random.rand(seq_len) < self.config.mask_proba
          mask_type = np.random.choice(
              ["mask", "random", "unchanged"],
              size=seq_len,
              p=[0.8, 0.1, 0.1],
          )
          random_tokens = np.random.randint(
              0, self.text_encoder.vocab_size, size=seq_len
          )
  
          # Make sure we don't accidentally mask the start / separator / end token
          mlm_mask[
              np.isin(
                  out.token_ids,
                  [
                      self.text_encoder.start_token,
                      self.text_encoder.delimiter_token,
                      self.text_encoder.end_token,
                  ],
              )
          ] = False
          mlm_positions = np.where(mlm_mask)[0]
  
          if (
              len(mlm_positions) > self.config.max_masked_tokens
          ):  # subsample
              np.random.shuffle(
                  mlm_positions
              )  # means we don't bias the begining of the sequence
              mlm_positions = mlm_positions[
                  : self.config.max_masked_tokens
              ]
              mlm_mask = np.zeros_like(mlm_mask)
              mlm_mask[mlm_positions] = True
  
          mlm_ids = out.token_ids[mlm_mask]
          mlm_weights = np.ones_like(mlm_ids)
  
          out.token_ids[
              mlm_mask & (mask_type == "mask")
          ] = self.text_encoder.mask_token
          out.token_ids[
              mlm_mask & (mask_type == "random")
          ] = random_tokens[mlm_mask & (mask_type == "random")]
  
          feats = {
              "tokens": out.token_ids,
              "mlm_weights": mlm_weights,
              "mlm_ids": mlm_ids,
              "mlm_positions": mlm_positions,
          }
          yield feats
  
imports: import tensorflow
  from tensorflow import TensorShape
  import numpy
  from finetune.errors import FinetuneError
  from finetune.base import PredictMode, BaseModel
  from finetune.base_models import RoBERTa, BERT
  from finetune.input_pipeline import BasePipeline
  from finetune.nn.target_blocks import masked_language_model
label_desc: Use image node_id 3 for calling the MaskedLanguageModelPipeline obj's underlying member method code with example usage: obj.text_to_tokens_mask(X, Y) without return types