class_docstr: Bert-based module for Inverse Cloze task.
class_docstr_tok: ["Bert-based","module","for","Inverse","Cloze","task","."]
code: def __init__(
      self,
      ict_head_size,
      num_tokentypes=1,
      parallel_output=True,
      only_query_model=False,
      only_block_model=False,
  ):
      super(ICTBertModel, self).__init__()
      bert_kwargs = dict(
          ict_head_size=ict_head_size,
          num_tokentypes=num_tokentypes,
          parallel_output=parallel_output,
      )
      assert not (only_block_model and only_query_model)
      self.use_block_model = not only_query_model
      self.use_query_model = not only_block_model
  
      if self.use_query_model:
          # this model embeds (pseudo-)queries - Embed_input in the paper
          self.query_model = IREncoderBertModel(**bert_kwargs)
          self._query_key = "question_model"
  
      if self.use_block_model:
          # this model embeds evidence blocks - Embed_doc in the paper
          self.block_model = IREncoderBertModel(**bert_kwargs)
          self._block_key = "context_model"
  
imports: import os
  import torch
  from megatron import get_args, print_rank_0
  from megatron.checkpointing import get_checkpoint_tracker_filename, get_checkpoint_name
  from megatron.model import BertModel
  from .module import MegatronModule
  from megatron.core import mpu
  from megatron.model.enums import AttnMaskType
  from megatron.model.utils import get_linear_layer
  from megatron.model.utils import init_method_normal
  from megatron.model.language_model import get_language_model
  from megatron.model.utils import scaled_init_method_normal
  from megatron.model.bert_model import bert_extended_attention_mask, bert_position_ids
label_desc: Use image node_id 1 to create a new ICTBertModel object from inherited base classes: MegatronModule with example: obj = ICTBertModel(ict_head_size, num_tokentypes, parallel_output, only_query_model, only_block_model)