
'''simple docstring'''






import numpy as np

from transformers import Pipeline





def    UpperCAmelCase							(  UpperCAmelCase__							:							List[Any]):
				lowerCamelCase					:			List[str]									= np.max(UpperCAmelCase__       ,							axis=-1       ,							keepdims=UpperCAmelCase__)
				lowerCamelCase					:			List[Any]									= np.exp(outputs - maxes)
				return shifted_exp / shifted_exp.sum(axis=-1       ,							keepdims=UpperCAmelCase__)




class     __snake_case		(   a__):
					def     UpperCAmelCase_							(     self,    **A      ):

									"""simple docstring"""


									lowerCamelCase					:			Union[str, Any]									= {}
									if "second_text" in kwargs:
													lowerCamelCase					:			List[Any]									= kwargs['second_text']
									return preprocess_kwargs, {}, {}
					def     UpperCAmelCase_							(     self,    A,    A=None      ):

									"""simple docstring"""


									return self.tokenizer(A,    text_pair=A,    return_tensors=self.framework      )
					def     UpperCAmelCase_							(     self,    A      ):

									"""simple docstring"""


									return self.model(**A      )




					def     UpperCAmelCase_							(     self,    A      ):

									"""simple docstring"""


									lowerCamelCase					:			Union[str, Any]									= model_outputs.logits[0].numpy()
									lowerCamelCase					:			Any									= softmax(A      )

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


'''simple docstring'''






import numpy as np





def    UpperCAmelCase							(  UpperCAmelCase__							:							np.array):
				return 1 / (1 + np.exp(-vector))


if __name__ == "__main__":
					import doctest

					doctest.testmod()
