class_docstr: PyTorch implementation containing all the modelling needed for your NLP task. Combines 2 language
  models for representation of 2 sequences and a prediction head. Allows for gradient flow back to the 2 language model components.
class_docstr_tok: ["PyTorch","implementation","containing","all","the","modelling","needed","for","your","NLP","task",".","Combines","2","language","models","for","representation","of","2","sequences","and","a","prediction","head",".","Allows","for","gradient","flow","back","to","the","2","language","model","components","."]
code: def convert_to_transformers(self):
      from transformers import (
          DPRContextEncoder,
          DPRQuestionEncoder,
          AutoModel,
      )
  
      if len(self.prediction_heads) != 1:
          raise ValueError(
              f"Currently conversion only works for models with a SINGLE prediction head. "
              f"Your model has {len(self.prediction_heads)}"
          )
  
      if self.prediction_heads[0].model_type == "text_similarity":
          # init model
          if (
              "dpr" in self.language_model1.model.config.model_type
              or self.language_model1.model.config.name
              == "DPRQuestionEncoder"
          ):
              transformers_model1 = DPRQuestionEncoder(
                  config=self.language_model1.model.config
              )
          else:
              transformers_model1 = AutoModel.from_config(
                  config=self.language_model1.model.config
              )
          if (
              "dpr" in self.language_model2.model.config.model_type
              or self.language_model2.model.config.name
              == "DPRContextEncoder"
          ):
              transformers_model2 = DPRContextEncoder(
                  config=self.language_model2.model.config
              )
          else:
              transformers_model2 = AutoModel.from_config(
                  config=self.language_model2.model.config
              )
  
          # transfer weights for language model + prediction head
          setattr(
              transformers_model1,
              transformers_model1.base_model_prefix,
              getattr(
                  self.language_model1.model,
                  self.language_model1.model.base_model_prefix,
              ),
          )
          setattr(
              transformers_model2,
              transformers_model2.base_model_prefix,
              getattr(
                  self.language_model2.model,
                  self.language_model2.model.base_model_prefix,
              ),
          )
          logger.warning(
              "No prediction head weights are required for DPR"
          )
  
      else:
          raise NotImplementedError(
              f"FARM -> Transformers conversion is not supported yet for"
              f" prediction heads of type {self.prediction_heads[0].model_type}"
          )
      pass
  
      return transformers_model1, transformers_model2
  
imports: import copy
  import json
  import logging
  import os
  from argparse import Namespace
  from pathlib import Path
  import multiprocessing
  import numpy
  import torch
  from torch import nn
  from farm.data_handler.processor import TextSimilarityProcessor
  from farm.data_handler.data_silo import DataSilo
  from farm.modeling.language_model import LanguageModel
  from farm.modeling.prediction_head import PredictionHead, TextSimilarityHead
  from farm.modeling.tokenization import Tokenizer
  from farm.utils import MLFlowLogger, stack
label_desc: Use image node_id 12 for calling the BiAdaptiveModel obj's underlying member method code with example usage: obj.convert_to_transformers() and returns: transformers_model1,  transformers_model2