class_docstr: BERT-based encoder for queries or contexts used for
  learned information retrieval.
class_docstr_tok: ["BERT-based","encoder","for","queries","or","contexts","used","for","learned","information","retrieval","."]
code: def __init__(
      self,
      num_tokentypes=2,
      parallel_output=True,
      pre_process=True,
      post_process=True,
  ):
      super(PretrainedBertModel, self).__init__()
  
      args = get_args()
      tokenizer = get_tokenizer()
      self.pad_id = tokenizer.pad
      self.biencoder_projection_dim = args.biencoder_projection_dim
      self.parallel_output = parallel_output
      self.pre_process = pre_process
      self.post_process = post_process
      init_method = init_method_normal(args.init_method_std)
      scaled_init_method = scaled_init_method_normal(
          args.init_method_std, args.num_layers
      )
  
      (
          self.language_model,
          self._language_model_key,
      ) = get_language_model(
          num_tokentypes=num_tokentypes,
          add_pooler=False,
          encoder_attn_mask_type=AttnMaskType.padding,
          init_method=init_method,
          scaled_init_method=scaled_init_method,
          pre_process=self.pre_process,
          post_process=self.post_process,
      )
  
      if args.biencoder_projection_dim > 0:
          self.projection_enc = get_linear_layer(
              args.hidden_size,
              args.biencoder_projection_dim,
              init_method,
          )
          self._projection_enc_key = "projection_enc"
  
imports: import os
  import torch
  import sys
  from megatron import get_args, print_rank_0, get_tokenizer
  from megatron.core import mpu
  from megatron.checkpointing import fix_query_key_value_ordering
  from megatron.checkpointing import get_checkpoint_tracker_filename
  from megatron.checkpointing import get_checkpoint_name
  from megatron.model.bert_model import bert_position_ids
  from megatron.model.enums import AttnMaskType
  from megatron.model.language_model import get_language_model
  from megatron.model.utils import get_linear_layer
  from megatron.model.utils import init_method_normal
  from megatron.model.utils import scaled_init_method_normal
  from .module import MegatronModule
label_desc: Use image node_id 1 to create a new PretrainedBertModel object from inherited base classes: MegatronModule with example: obj = PretrainedBertModel(num_tokentypes, parallel_output, pre_process, post_process)