class_docstr: Text Pair Regression Model for tasks such as Semantic Textual Similarity Benchmark.
  
  The model takes document embeddings and puts resulting text representation(s) into a linear layer to get the
  score. 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","Regression","Model","for","tasks","such","as","Semantic","Textual","Similarity","Benchmark",".","The","model","takes","document","embeddings","and","puts","resulting","text","representation","(","s",")","into","a","linear","layer","to","get","the","score",".","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","''",")","."]
code: def predict(
      self,
      pairs: Union[TextPair, List[TextPair]],
      mini_batch_size: int = 32,
      verbose: bool = False,
      label_name: Optional[str] = None,
      embedding_storage_mode="none",
  ) -> List[TextPair]:
      if label_name is None:
          label_name = (
              self.label_name
              if self.label_name is not None
              else "label"
          )
  
      with torch.no_grad():
          if isinstance(pairs, list):
              if len(pairs) == 0:
                  return []
          else:
              pairs = [pairs]
  
          filtered_pairs = [
              pair for pair in pairs if self._filter_data_point(pair)
          ]
  
          if len(filtered_pairs) == 0:
              return pairs
  
          reordered_pairs = sorted(
              filtered_pairs,
              key=lambda pair: len(pair.first) + len(pair.second),
              reverse=True,
          )
  
          dataloader = DataLoader(
              dataset=FlairDatapointDataset(reordered_pairs),
              batch_size=mini_batch_size,
          )
          # progress bar for verbosity
          if verbose:
              progress_bar = tqdm(dataloader)
              progress_bar.set_description("Batch inference")
              dataloader = progress_bar
  
          for batch in dataloader:
              # stop if all sentences are empty
              if not batch:
                  continue
  
              data_point_tensor = self._encode_data_points(pairs)
              scores = self.decoder(data_point_tensor)
  
              for sentence, score in zip(batch, scores.tolist()):
                  sentence.set_label(label_name, value=str(score[0]))
  
              # clearing token embeddings to save memory
              store_embeddings(
                  batch, storage_mode=embedding_storage_mode
              )
  
          return pairs
  
imports: import typing
  from pathlib import Path
  from typing import Any, List, Optional, Tuple, Union
  import torch
  from torch import nn
  from torch.utils.data.dataset import Dataset
  from tqdm import tqdm
  import flair.embeddings
  import flair.nn
  from flair.data import Corpus, Dictionary, Sentence, TextPair, _iter_dataset
  from flair.datasets import DataLoader, FlairDatapointDataset
  from flair.nn.model import ReduceTransformerVocabMixin
  from flair.training_utils import MetricRegression, Result, store_embeddings
label_desc: Use image node_id 13 for calling the TextPairRegressor obj's underlying member method code with example usage: obj.predict(pairs, mini_batch_size, verbose, label_name, embedding_storage_mode) and returns: pairs, pairs, list