class_docstr: Task for used with Masked language modelling.
  
  .. todo::
      Describe MLM
  
  :param mask_ratio: Fraction of tokens to mask.
  :param smart_masking: Whether to apply smart masking (use tokens from the same group when choosing randoms).
class_docstr_tok: ["Task","for","used","with","Masked","language","modelling",".","..","todo",":",":","Describe","MLM",":","param","mask_ratio",":","Fraction","of","tokens","to","mask",".",":","param","smart_masking",":","Whether","to","apply","smart","masking","(","use","tokens","from","the","same","group","when","choosing","randoms",")","."]
docstr: Applies the smart_masking scheme
docstr_tok: ["Applies","the","smart_masking","scheme"]
code: def smart_masked(x: np.ndarray, min_i: int, max_i: int) -> np.ndarray:
      """Applies the smart_masking scheme"""
      ix = np.argwhere((x >= min_i) & (x < max_i))
      if len(ix) > 0:
          x[ix] = np.random.randint(
              low=min_i, high=max_i, size=(len(ix), 1)
          )
      return x
  
file_path: life2vec/src/tasks/mlm.py
imports: import logging
  from dataclasses import dataclass
  from functools import cached_property
  from itertools import chain
  from typing import List, Tuple, TypeVar, cast
  from xml.dom.minidom import Document
  import numpy
  import torch
  from random import shuffle
  from src.data_new.types import Background, PersonDocument, EncodedDocument
  from src.tasks.base import Task
label_desc: Use image node_id 5 for calling the MLM obj's underlying member method code with example usage: obj.smart_masked(x, min_i, max_i) and returns: x