



import numpy as np

from transformers import Pipeline







def       lowerCAmelCase_     (lowerCAmelCase__:						Optional[Any]   ):





			"""simple docstring"""


			UpperCAmelCase_:						Optional[Any]					=			np.max(_lowerCAmelCase						,		axis=-1						,		keepdims=_lowerCAmelCase   )
			UpperCAmelCase_:						List[str]					=			np.exp(outputs - maxes   )
			return shifted_exp / shifted_exp.sum(axis=-1						,		keepdims=_lowerCAmelCase   )







class 							_a							(					_a ):

			def 			__snake_case    (self,					**SCREAMING_SNAKE_CASE_ )    ->					List[Any]:
						UpperCAmelCase_:						Optional[int]					=			{}
						if "second_text" in kwargs:
									UpperCAmelCase_:						Union[str, Any]					=			kwargs["""second_text"""]
						return preprocess_kwargs, {}, {}

			def 			__snake_case    (self,					SCREAMING_SNAKE_CASE_,					SCREAMING_SNAKE_CASE_=None )    ->					Any:
						return self.tokenizer(snake_case_,					text_pair=snake_case_,					return_tensors=self.framework )

			def 			__snake_case    (self,					SCREAMING_SNAKE_CASE_ )    ->					Union[str, Any]:
						return self.model(**snake_case_ )

			def 			__snake_case    (self,					SCREAMING_SNAKE_CASE_ )    ->					Tuple:
						UpperCAmelCase_:						Union[str, Any]					=			model_outputs.logits[0].numpy()
						UpperCAmelCase_:						List[str]					=			softmax(snake_case_ )

						UpperCAmelCase_:						List[str]					=			np.argmax(snake_case_ )
						UpperCAmelCase_:						List[str]					=			self.model.config.idalabel[best_class]
						UpperCAmelCase_:						Optional[int]					=			probabilities[best_class].item()
						UpperCAmelCase_:						str					=			logits.tolist()
						return {"label": label, "score": score, "logits": logits}











'''simple docstring'''





from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


__a          =		{
    "configuration_bloom": ["BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP", "BloomConfig", "BloomOnnxConfig"],
}
try:
       if not is_tokenizers_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __a          =		["BloomTokenizerFast"]

try:
       if not is_torch_available():
              raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
       pass
else:
       __a          =		[
           "BLOOM_PRETRAINED_MODEL_ARCHIVE_LIST",
           "BloomForCausalLM",
           "BloomModel",
           "BloomPreTrainedModel",
           "BloomForSequenceClassification",
           "BloomForTokenClassification",
           "BloomForQuestionAnswering",
       ]

if TYPE_CHECKING:
       from .configuration_bloom import BLOOM_PRETRAINED_CONFIG_ARCHIVE_MAP, BloomConfig, BloomOnnxConfig

       try:
              if not is_tokenizers_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .tokenization_bloom_fast import BloomTokenizerFast

       try:
              if not is_torch_available():
                     raise OptionalDependencyNotAvailable()
       except OptionalDependencyNotAvailable:
              pass
       else:
              from .modeling_bloom import (
                  BLOOM_PRETRAINED_MODEL_ARCHIVE_LIST,
                  BloomForCausalLM,
                  BloomForQuestionAnswering,
                  BloomForSequenceClassification,
                  BloomForTokenClassification,
                  BloomModel,
                  BloomPreTrainedModel,
              )

else:
       import sys

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