docstr: Parameters
  ----------
  backbone_cfg
      The cfg of the backbone model
docstr_tok: ["Parameters","--","--","--","--","--","backbone_cfg","The","cfg","of","the","backbone","model"]
code: def __init__(self, backbone_cfg):
      """
  
      Parameters
      ----------
      backbone_cfg
          The cfg of the backbone model
      """
      super().__init__()
      self.backbone_model = BertModel.from_cfg(backbone_cfg)
      # Construct nsp_classifier for next sentence prediction
      self.nsp_classifier = th.nn.Linear(
          out_features=2, in_features=self.backbone_model.units
      )
      self.mlm_decoder = th.nn.Sequential(
          th.nn.Linear(
              out_features=self.backbone_model.units,
              in_features=self.backbone_model.units,
          ),
          get_activation(self.backbone_model.activation),
          th.nn.LayerNorm(
              self.backbone_model.units,
              eps=self.backbone_model.layer_norm_eps,
          ),
          th.nn.Linear(
              out_features=self.backbone_model.vocab_size,
              in_features=self.backbone_model.units,
          ),
      )
      # TODO such weight sharing not supported in torchscript
      self.mlm_decoder[
          -1
      ].weight = self.backbone_model.word_embed.weight
  
imports: import logging
  import torch
  from ..attention_cell import gen_self_attn_mask
  from .transformer import TransformerEncoderLayer
  from ..layers import get_activation, sequence_mask
  from ...utils.registry import Registry
  from ...models.bert import bert_cfg_reg
label_desc: Use image node_id 1 to create a new BertForPretrain object from inherited base classes: th.nn with example: obj = BertForPretrain(backbone_cfg)