class_docstr: Class for training a Masked Language Model. It also supports an
  additional sentence level prediction if the sent-loss argument is set.
class_docstr_tok: ["Class","for","training","a","Masked","Language","Model",".","It","also","supports","an","additional","sentence","level","prediction","if","the","sent-loss","argument","is","set","."]
code: def __init__(self, args, encoder):
      super().__init__(encoder)
      self.args = args
  
      # if specified then apply bert initialization on the model. We need
      # to explictly call this to make sure that the output embeddings
      # and projection layers are also correctly initialized
      if getattr(args, "apply_bert_init", False):
          self.apply(init_bert_params)
  
imports: import logging
  import torch
  import torch.nn
  import torch.nn.functional
  from fairseq import utils
  from fairseq.models import FairseqEncoder, FairseqEncoderModel, register_model, register_model_architecture
  from fairseq.modules import LayerNorm, SinusoidalPositionalEmbedding, TransformerSentenceEncoder
  from fairseq.modules.transformer_sentence_encoder import init_bert_params
  from fairseq.utils import safe_hasattr
label_desc: Use image node_id 1 to create a new MaskedLMModel object from inherited base classes: FairseqEncoderModel with example: obj = MaskedLMModel(args, encoder)