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","."]
docstr: Push data through the whole model and returns logits. The data will propagate through
  the first language model and second language model based on the tensor names and both the
  encodings through each of the attached prediction heads.
  
  :param kwargs: Holds all arguments that need to be passed to both the language models and prediction head(s).
  :return: all logits as torch.tensor or multiple tensors.
docstr_tok: ["Push","data","through","the","whole","model","and","returns","logits",".","The","data","will","propagate","through","the","first","language","model","and","second","language","model","based","on","the","tensor","names","and","both","the","encodings","through","each","of","the","attached","prediction","heads",".",":","param","kwargs",":","Holds","all","arguments","that","need","to","be","passed","to","both","the","language","models","and","prediction","head","(","s",")",".",":","return",":","all","logits","as","torch.tensor","or","multiple","tensors","."]
code: def forward(self, **kwargs):
      """
      Push data through the whole model and returns logits. The data will propagate through
      the first language model and second language model based on the tensor names and both the
      encodings through each of the attached prediction heads.
  
      :param kwargs: Holds all arguments that need to be passed to both the language models and prediction head(s).
      :return: all logits as torch.tensor or multiple tensors.
      """
  
      # Run forward pass of both language models
      pooled_output = self.forward_lm(**kwargs)
  
      # Run forward pass of (multiple) prediction heads using the output from above
      all_logits = []
      if len(self.prediction_heads) > 0:
          for head, lm1_out, lm2_out in zip(
              self.prediction_heads,
              self.lm1_output_types,
              self.lm2_output_types,
          ):
              # Choose relevant vectors from LM as output and perform dropout
              if pooled_output[0] is not None:
                  if (
                      lm1_out == "per_sequence"
                      or lm1_out == "per_sequence_continuous"
                  ):
                      output1 = self.dropout1(pooled_output[0])
                  else:
                      raise ValueError(
                          "Unknown extraction strategy from BiAdaptive language_model1: {}".format(
                              lm1_out
                          )
                      )
              else:
                  output1 = None
  
              if pooled_output[1] is not None:
                  if (
                      lm2_out == "per_sequence"
                      or lm2_out == "per_sequence_continuous"
                  ):
                      output2 = self.dropout2(pooled_output[1])
                  else:
                      raise ValueError(
                          "Unknown extraction strategy from BiAdaptive language_model2: {}".format(
                              lm2_out
                          )
                      )
              else:
                  output2 = None
  
              embedding1, embedding2 = head(output1, output2)
              all_logits.append(tuple([embedding1, embedding2]))
      else:
          # just return LM output (e.g. useful for extracting embeddings at inference time)
          all_logits.append((pooled_output))
  
      return all_logits
  
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 7 for calling the BiAdaptiveModel obj's underlying member method code with example usage: obj.forward() and returns: all_logits