





'''simple docstring'''


import numpy as np

from transformers import Pipeline


def 	__a(SCREAMING_SNAKE_CASE_  :					Tuple    ):



    '''simple docstring'''





    _lowerCAmelCase				=      np.max(SCREAMING_SNAKE_CASE_		,       axis=-1		,       keepdims=SCREAMING_SNAKE_CASE_    )
    _lowerCAmelCase				=      np.exp(outputs - maxes    )
    return shifted_exp / shifted_exp.sum(axis=-1		,       keepdims=SCREAMING_SNAKE_CASE_    )





class    lowerCAmelCase_		(		__magic_name__		):




 def 							_snake_case   (	self			,     **_lowerCAmelCase		)    ->							str:
     _lowerCAmelCase				=      {}
     if "second_text" in kwargs:
         _lowerCAmelCase				=      kwargs["second_text"]
     return preprocess_kwargs, {}, {}




 def 							_snake_case   (	self			,     _lowerCAmelCase			,     _lowerCAmelCase=None		)    ->							Tuple:
     return self.tokenizer(_lowerCAmelCase			,     text_pair=_lowerCAmelCase			,     return_tensors=self.framework		)




 def 							_snake_case   (	self			,     _lowerCAmelCase		)    ->							List[str]:
     return self.model(**_lowerCAmelCase		)





 def 							_snake_case   (	self			,     _lowerCAmelCase		)    ->							Union[str, Any]:
     _lowerCAmelCase				=      model_outputs.logits[0].numpy()
     _lowerCAmelCase				=      softmax(_lowerCAmelCase		)

     _lowerCAmelCase				=      np.argmax(_lowerCAmelCase		)
     _lowerCAmelCase				=      self.model.config.idalabel[best_class]
     _lowerCAmelCase				=      probabilities[best_class].item()
     _lowerCAmelCase				=      logits.tolist()
     return {"label": label, "score": score, "logits": logits}









'''simple docstring'''


from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


_SCREAMING_SNAKE_CASE	 =							{
    "configuration_bigbird_pegasus": [
        "BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "BigBirdPegasusConfig",
        "BigBirdPegasusOnnxConfig",
    ],
}

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       _SCREAMING_SNAKE_CASE	 =							[
           "BIGBIRD_PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST",
           "BigBirdPegasusForCausalLM",
           "BigBirdPegasusForConditionalGeneration",
           "BigBirdPegasusForQuestionAnswering",
           "BigBirdPegasusForSequenceClassification",
           "BigBirdPegasusModel",
           "BigBirdPegasusPreTrainedModel",
       ]


if TYPE_CHECKING:
       from .configuration_bigbird_pegasus import (
           BIGBIRD_PEGASUS_PRETRAINED_CONFIG_ARCHIVE_MAP,
           BigBirdPegasusConfig,
           BigBirdPegasusOnnxConfig,
       )

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_bigbird_pegasus import (
                  BIGBIRD_PEGASUS_PRETRAINED_MODEL_ARCHIVE_LIST,
                  BigBirdPegasusForCausalLM,
                  BigBirdPegasusForConditionalGeneration,
                  BigBirdPegasusForQuestionAnswering,
                  BigBirdPegasusForSequenceClassification,
                  BigBirdPegasusModel,
                  BigBirdPegasusPreTrainedModel,
              )


else:
       import sys

       _SCREAMING_SNAKE_CASE	 =							_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


