class_docstr: Text classification pipeline using any `ModelForSequenceClassification`. See the [sequence classification
  examples](../task_summary#sequence-classification) for more information.
  
  This text classification pipeline can currently be loaded from [`pipeline`] using the following task identifier:
  `"sentiment-analysis"` (for classifying sequences according to positive or negative sentiments).
  
  If multiple classification labels are available (`model.config.num_labels >= 2`), the pipeline will run a softmax
  over the results. If there is a single label, the pipeline will run a sigmoid over the result.
  
  The models that this pipeline can use are models that have been fine-tuned on a sequence classification task. See
  the up-to-date list of available models on
  [huggingface.co/models](https://huggingface.co/models?filter=text-classification).
class_docstr_tok: ["Text","classification","pipeline","using","any","`","ModelForSequenceClassification","`",".","See","the","[","sequence","classification","examples","]","(","..","\/task_summary","#","sequence-classification",")","for","more","information",".","This","text","classification","pipeline","can","currently","be","loaded","from","[","`","pipeline","`","]","using","the","following","task","identifier",":","`","``","sentiment-analysis","''","`","(","for","classifying","sequences","according","to","positive","or","negative","sentiments",")",".","If","multiple","classification","labels","are","available","(","`","model.config.num_labels",">","=","2","`",")",",","the","pipeline","will","run","a","softmax","over","the","results",".","If","there","is","a","single","label",",","the","pipeline","will","run","a","sigmoid","over","the","result",".","The","models","that","this","pipeline","can","use","are","models","that","have","been","fine-tuned","on","a","sequence","classification","task",".","See","the","up-to-date","list","of","available","models","on","[","huggingface.co\/models","]","(","https",":","\/\/huggingface.co\/models","?","filter=text-classification",")","."]
code: def preprocess(
      self, inputs, **tokenizer_kwargs
  ) -> Dict[str, GenericTensor]:
      return_tensors = self.framework
      if isinstance(inputs, dict):
          return self.tokenizer(
              **inputs,
              return_tensors=return_tensors,
              **tokenizer_kwargs,
          )
      elif (
          isinstance(inputs, list)
          and len(inputs) == 1
          and isinstance(inputs[0], list)
          and len(inputs[0]) == 2
      ):
          # It used to be valid to use a list of list of list for text pairs, keeping this path for BC
          return self.tokenizer(
              text=inputs[0][0],
              text_pair=inputs[0][1],
              return_tensors=return_tensors,
              **tokenizer_kwargs,
          )
      elif isinstance(inputs, list):
          # This is likely an invalid usage of the pipeline attempting to pass text pairs.
          raise ValueError(
              "The pipeline received invalid inputs, if you are trying to send text pairs, you can try to send a"
              ' dictionnary `{"text": "My text", "text_pair": "My pair"}` in order to send a text pair.'
          )
      return self.tokenizer(
          inputs, return_tensors=return_tensors, **tokenizer_kwargs
      )
  
file_path: H2O/h2o_flexgen/benchmark/third_party/transformers/src/transformers/pipelines/text_classification.py
imports: import warnings
  from typing import Dict
  import numpy
  from ..utils import ExplicitEnum, add_end_docstrings, is_tf_available, is_torch_available
  from .base import PIPELINE_INIT_ARGS, GenericTensor, Pipeline
label_desc: Use image node_id 4 for calling the TextClassificationPipeline obj's underlying member method code with example usage: obj.preprocess(inputs) and returns: self, self, self