class_docstr: Text Pair Classification Model for tasks such as Recognizing Textual Entailment, build upon TextClassifier.
  
  The model takes document embeddings and puts resulting text representation(s) into a linear layer to get the
  actual class label. We provide two ways to embed the DataPairs: Either by embedding both DataPoints
  and concatenating the resulting vectors ("embed_separately=True") or by concatenating the DataPoints and embedding
  the resulting vector ("embed_separately=False").
class_docstr_tok: ["Text","Pair","Classification","Model","for","tasks","such","as","Recognizing","Textual","Entailment",",","build","upon","TextClassifier",".","The","model","takes","document","embeddings","and","puts","resulting","text","representation","(","s",")","into","a","linear","layer","to","get","the","actual","class","label",".","We","provide","two","ways","to","embed","the","DataPairs",":","Either","by","embedding","both","DataPoints","and","concatenating","the","resulting","vectors","(","``","embed_separately=True","''",")","or","by","concatenating","the","DataPoints","and","embedding","the","resulting","vector","(","``","embed_separately=False","''",")","."]
docstr: Initializes a TextPairClassifier.
  
  Args:
      label_type: label_type: name of the label
      embed_separately: if True, the sentence embeddings will be concatenated,
        if False both sentences will be combined and newly embedded.
      embeddings: embeddings used to embed each data point
      label_dictionary: dictionary of labels you want to predict
      multi_label: auto-detected by default, but you can set this to True to force multi-label prediction
         or False to force single-label prediction
      multi_label_threshold: If multi-label you can set the threshold to make predictions
      loss_weights: Dictionary of weights for labels for the loss function.
        If any label's weight is unspecified it will default to 1.0
      **classifierargs: The arguments propagated to :meth:`flair.nn.DefaultClassifier.__init__`
docstr_tok: ["Initializes","a","TextPairClassifier",".","Args",":","label_type",":","label_type",":","name","of","the","label","embed_separately",":","if","True",",","the","sentence","embeddings","will","be","concatenated",",","if","False","both","sentences","will","be","combined","and","newly","embedded",".","embeddings",":","embeddings","used","to","embed","each","data","point","label_dictionary",":","dictionary","of","labels","you","want","to","predict","multi_label",":","auto-detected","by","default",",","but","you","can","set","this","to","True","to","force","multi-label","prediction","or","False","to","force","single-label","prediction","multi_label_threshold",":","If","multi-label","you","can","set","the","threshold","to","make","predictions","loss_weights",":","Dictionary","of","weights","for","labels","for","the","loss","function",".","If","any","label","'s","weight","is","unspecified","it","will","default","to","1.0","*","*","classifierargs",":","The","arguments","propagated","to",":","meth",":","`","flair.nn.DefaultClassifier.__init__","`"]
code: def __init__(
      self,
      embeddings: flair.embeddings.DocumentEmbeddings,
      label_type: str,
      embed_separately: bool = False,
      **classifierargs,
  ) -> None:
      """Initializes a TextPairClassifier.
  
      Args:
          label_type: label_type: name of the label
          embed_separately: if True, the sentence embeddings will be concatenated,
            if False both sentences will be combined and newly embedded.
          embeddings: embeddings used to embed each data point
          label_dictionary: dictionary of labels you want to predict
          multi_label: auto-detected by default, but you can set this to True to force multi-label prediction
             or False to force single-label prediction
          multi_label_threshold: If multi-label you can set the threshold to make predictions
          loss_weights: Dictionary of weights for labels for the loss function.
            If any label's weight is unspecified it will default to 1.0
          **classifierargs: The arguments propagated to :meth:`flair.nn.DefaultClassifier.__init__`
      """
      super().__init__(
          **classifierargs,
          embeddings=embeddings,
          final_embedding_size=2 * embeddings.embedding_length
          if embed_separately
          else embeddings.embedding_length,
          should_embed_sentence=False,
      )
  
      self._label_type = label_type
  
      self.embed_separately = embed_separately
  
      if not self.embed_separately:
          # set separator to concatenate two sentences
          self.sep = " "
          if isinstance(
              self.embeddings,
              flair.embeddings.document.TransformerDocumentEmbeddings,
          ):
              if self.embeddings.tokenizer.sep_token:
                  self.sep = (
                      " "
                      + str(self.embeddings.tokenizer.sep_token)
                      + " "
                  )
              else:
                  self.sep = " [SEP] "
  
      # auto-spawn on GPU if available
      self.to(flair.device)
  
file_path: flair/flair/models/pairwise_classification_model.py
imports: import typing
  from typing import List
  import torch
  import flair.embeddings
  import flair.nn
  from flair.data import Corpus, Sentence, TextPair, _iter_dataset
label_desc: Use image node_id 1 to create a new TextPairClassifier object from inherited base classes: flair.nn.DefaultClassifier with example: obj = TextPairClassifier(embeddings, label_type, embed_separately)