class_docstr: NLI-based zero-shot classification pipeline using a `ModelForSequenceClassification` trained on NLI (natural
  language inference) tasks. Equivalent of `text-classification` pipelines, but these models don't require a
  hardcoded number of potential classes, they can be chosen at runtime. It usually means it's slower but it is
  **much** more flexible.
  
  Any combination of sequences and labels can be passed and each combination will be posed as a premise/hypothesis
  pair and passed to the pretrained model. Then, the logit for *entailment* is taken as the logit for the candidate
  label being valid. Any NLI model can be used, but the id of the *entailment* label must be included in the model
  config's :attr:*~transformers.PretrainedConfig.label2id*.
  
  Example:
  
  ```python
  >>> from transformers import pipeline
  
  >>> oracle = pipeline(model="facebook/bart-large-mnli")
  >>> oracle(
  ...     "I have a problem with my iphone that needs to be resolved asap!!",
  ...     candidate_labels=["urgent", "not urgent", "phone", "tablet", "computer"],
  ... )
  {'sequence': 'I have a problem with my iphone that needs to be resolved asap!!', 'labels': ['urgent', 'phone', 'computer', 'not urgent', 'tablet'], 'scores': [0.504, 0.479, 0.013, 0.003, 0.002]}
  
  >>> oracle(
  ...     "I have a problem with my iphone that needs to be resolved asap!!",
  ...     candidate_labels=["english", "german"],
  ... )
  {'sequence': 'I have a problem with my iphone that needs to be resolved asap!!', 'labels': ['english', 'german'], 'scores': [0.814, 0.186]}
  ```
  
  Learn more about the basics of using a pipeline in the [pipeline tutorial](../pipeline_tutorial)
  
  This NLI pipeline can currently be loaded from [`pipeline`] using the following task identifier:
  `"zero-shot-classification"`.
  
  The models that this pipeline can use are models that have been fine-tuned on an NLI task. See the up-to-date list
  of available models on [huggingface.co/models](https://huggingface.co/models?search=nli).
class_docstr_tok: ["NLI-based","zero-shot","classification","pipeline","using","a","`","ModelForSequenceClassification","`","trained","on","NLI","(","natural","language","inference",")","tasks",".","Equivalent","of","`","text-classification","`","pipelines",",","but","these","models","do","n't","require","a","hardcoded","number","of","potential","classes",",","they","can","be","chosen","at","runtime",".","It","usually","means","it","'s","slower","but","it","is","*","*","much","*","*","more","flexible",".","Any","combination","of","sequences","and","labels","can","be","passed","and","each","combination","will","be","posed","as","a","premise\/hypothesis","pair","and","passed","to","the","pretrained","model",".","Then",",","the","logit","for","*","entailment","*","is","taken","as","the","logit","for","the","candidate","label","being","valid",".","Any","NLI","model","can","be","used",",","but","the","id","of","the","*","entailment","*","label","must","be","included","in","the","model","config","'s",":","attr",":","*","~transformers.PretrainedConfig.label2id","*",".","Example",":","``","`","python",">",">",">","from","transformers","import","pipeline",">",">",">","oracle","=","pipeline","(","model=","''","facebook\/bart-large-mnli","''",")",">",">",">","oracle","(","...","``","I","have","a","problem","with","my","iphone","that","needs","to","be","resolved","asap","!","!","``",",","...","candidate_labels=","[","``","urgent","''",",","``","not","urgent","''",",","``","phone","''",",","``","tablet","''",",","``","computer","''","]",",","...",")","{","'sequence","'",":","'","I","have","a","problem","with","my","iphone","that","needs","to","be","resolved","asap","!","!","'",",","'labels","'",":","[","'urgent","'",",","'phone","'",",","'computer","'",",","'not","urgent","'",",","'tablet","'","]",",","'scores","'",":","[","0.504",",","0.479",",","0.013",",","0.003",",","0.002","]","}",">",">",">","oracle","(","...","``","I","have","a","problem","with","my","iphone","that","needs","to","be","resolved","asap","!","!","``",",","...","candidate_labels=","[","``","english","''",",","``","german","''","]",",","...",")","{","'sequence","'",":","'","I","have","a","problem","with","my","iphone","that","needs","to","be","resolved","asap","!","!","'",",","'labels","'",":","[","'english","'",",","'german","'","]",",","'scores","'",":","[","0.814",",","0.186","]","}","``","`","Learn","more","about","the","basics","of","using","a","pipeline","in","the","[","pipeline","tutorial","]","(","..","\/pipeline_tutorial",")","This","NLI","pipeline","can","currently","be","loaded","from","[","`","pipeline","`","]","using","the","following","task","identifier",":","`","``","zero-shot-classification","''","`",".","The","models","that","this","pipeline","can","use","are","models","that","have","been","fine-tuned","on","an","NLI","task",".","See","the","up-to-date","list","of","available","models","on","[","huggingface.co\/models","]","(","https",":","\/\/huggingface.co\/models","?","search=nli",")","."]
docstr: Classify the sequence(s) given as inputs. See the [`ZeroShotClassificationPipeline`] documentation for more
  information.
  
  Args:
      sequences (`str` or `List[str]`):
          The sequence(s) to classify, will be truncated if the model input is too large.
      candidate_labels (`str` or `List[str]`):
          The set of possible class labels to classify each sequence into. Can be a single label, a string of
          comma-separated labels, or a list of labels.
      hypothesis_template (`str`, *optional*, defaults to `"This example is {}."`):
          The template used to turn each label into an NLI-style hypothesis. This template must include a {} or
          similar syntax for the candidate label to be inserted into the template. For example, the default
          template is `"This example is {}."` With the candidate label `"sports"`, this would be fed into the
          model like `"<cls> sequence to classify <sep> This example is sports . <sep>"`. The default template
          works well in many cases, but it may be worthwhile to experiment with different templates depending on
          the task setting.
      multi_label (`bool`, *optional*, defaults to `False`):
          Whether or not multiple candidate labels can be true. If `False`, the scores are normalized such that
          the sum of the label likelihoods for each sequence is 1. If `True`, the labels are considered
          independent and probabilities are normalized for each candidate by doing a softmax of the entailment
          score vs. the contradiction score.
  
  Return:
      A `dict` or a list of `dict`: Each result comes as a dictionary with the following keys:
  
      - **sequence** (`str`) -- The sequence for which this is the output.
      - **labels** (`List[str]`) -- The labels sorted by order of likelihood.
      - **scores** (`List[float]`) -- The probabilities for each of the labels.
docstr_tok: ["Classify","the","sequence","(","s",")","given","as","inputs",".","See","the","[","`","ZeroShotClassificationPipeline","`","]","documentation","for","more","information",".","Args",":","sequences","(","`","str","`","or","`","List","[","str","]","`",")",":","The","sequence","(","s",")","to","classify",",","will","be","truncated","if","the","model","input","is","too","large",".","candidate_labels","(","`","str","`","or","`","List","[","str","]","`",")",":","The","set","of","possible","class","labels","to","classify","each","sequence","into",".","Can","be","a","single","label",",","a","string","of","comma-separated","labels",",","or","a","list","of","labels",".","hypothesis_template","(","`","str","`",",","*","optional","*",",","defaults","to","`","``","This","example","is","{","}",".","``","`",")",":","The","template","used","to","turn","each","label","into","an","NLI-style","hypothesis",".","This","template","must","include","a","{","}","or","similar","syntax","for","the","candidate","label","to","be","inserted","into","the","template",".","For","example",",","the","default","template","is","`","``","This","example","is","{","}",".","``","`","With","the","candidate","label","`","``","sports","''","`",",","this","would","be","fed","into","the","model","like","`","``","<","cls",">","sequence","to","classify","<","sep",">","This","example","is","sports",".","<","sep",">","''","`",".","The","default","template","works","well","in","many","cases",",","but","it","may","be","worthwhile","to","experiment","with","different","templates","depending","on","the","task","setting",".","multi_label","(","`","bool","`",",","*","optional","*",",","defaults","to","`","False","`",")",":","Whether","or","not","multiple","candidate","labels","can","be","true",".","If","`","False","`",",","the","scores","are","normalized","such","that","the","sum","of","the","label","likelihoods","for","each","sequence","is","1",".","If","`","True","`",",","the","labels","are","considered","independent","and","probabilities","are","normalized","for","each","candidate","by","doing","a","softmax","of","the","entailment","score","vs.","the","contradiction","score",".","Return",":","A","`","dict","`","or","a","list","of","`","dict","`",":","Each","result","comes","as","a","dictionary","with","the","following","keys",":","-","*","*","sequence","*","*","(","`","str","`",")","--","The","sequence","for","which","this","is","the","output",".","-","*","*","labels","*","*","(","`","List","[","str","]","`",")","--","The","labels","sorted","by","order","of","likelihood",".","-","*","*","scores","*","*","(","`","List","[","float","]","`",")","--","The","probabilities","for","each","of","the","labels","."]
code: def __call__(
      self,
      sequences: Union[str, List[str]],
      *args,
      **kwargs,
  ):
      """
      Classify the sequence(s) given as inputs. See the [`ZeroShotClassificationPipeline`] documentation for more
      information.
  
      Args:
          sequences (`str` or `List[str]`):
              The sequence(s) to classify, will be truncated if the model input is too large.
          candidate_labels (`str` or `List[str]`):
              The set of possible class labels to classify each sequence into. Can be a single label, a string of
              comma-separated labels, or a list of labels.
          hypothesis_template (`str`, *optional*, defaults to `"This example is {}."`):
              The template used to turn each label into an NLI-style hypothesis. This template must include a {} or
              similar syntax for the candidate label to be inserted into the template. For example, the default
              template is `"This example is {}."` With the candidate label `"sports"`, this would be fed into the
              model like `"<cls> sequence to classify <sep> This example is sports . <sep>"`. The default template
              works well in many cases, but it may be worthwhile to experiment with different templates depending on
              the task setting.
          multi_label (`bool`, *optional*, defaults to `False`):
              Whether or not multiple candidate labels can be true. If `False`, the scores are normalized such that
              the sum of the label likelihoods for each sequence is 1. If `True`, the labels are considered
              independent and probabilities are normalized for each candidate by doing a softmax of the entailment
              score vs. the contradiction score.
  
      Return:
          A `dict` or a list of `dict`: Each result comes as a dictionary with the following keys:
  
          - **sequence** (`str`) -- The sequence for which this is the output.
          - **labels** (`List[str]`) -- The labels sorted by order of likelihood.
          - **scores** (`List[float]`) -- The probabilities for each of the labels.
      """
      if len(args) == 0:
          pass
      elif len(args) == 1 and "candidate_labels" not in kwargs:
          kwargs["candidate_labels"] = args[0]
      else:
          raise ValueError(
              f"Unable to understand extra arguments {args}"
          )
  
      return super().__call__(sequences, **kwargs)
  
file_path: transformers/src/transformers/pipelines/zero_shot_classification.py
imports: import inspect
  from typing import List, Union
  import numpy
  from ..tokenization_utils import TruncationStrategy
  from ..utils import add_end_docstrings, logging
  from .base import PIPELINE_INIT_ARGS, ArgumentHandler, ChunkPipeline
label_desc: Use image node_id 5 for calling the ZeroShotClassificationPipeline obj's underlying member method code with example usage: obj.__call__(sequences) and returns: super