






import numpy as np

from transformers import Pipeline

def 	__lowerCamelCase      (		snake_case__		)							->  Union[str, Any]:






						"""simple docstring"""





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




class 				__UpperCAmelCase		(_UpperCAmelCase   ):







			def 							UpperCamelCase				(     self:  Optional[Any]				,     **UpperCAmelCase_:  Dict					):







									'''simple docstring'''




									_SCREAMING_SNAKE_CASE     				=  {}
									if "second_text" in kwargs:
															_SCREAMING_SNAKE_CASE     				=  kwargs["""second_text"""]
									return preprocess_kwargs, {}, {}







			def 							UpperCamelCase				(     self:  Tuple				,     UpperCAmelCase_:  Any				,     UpperCAmelCase_:  Optional[int]=None					):







									'''simple docstring'''




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







			def 							UpperCamelCase				(     self:  Dict				,     UpperCAmelCase_:  Tuple					):







									'''simple docstring'''




									return self.model(**UpperCAmelCase_					)







			def 							UpperCamelCase				(     self:  Dict				,     UpperCAmelCase_:  List[Any]					):







									'''simple docstring'''




									_SCREAMING_SNAKE_CASE     				=  model_outputs.logits[0].numpy()
									_SCREAMING_SNAKE_CASE     				=  softmax(UpperCAmelCase_					)

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









from typing import TYPE_CHECKING

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


UpperCamelCase			    =     {'''configuration_mmbt''': ['''MMBTConfig''']}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		UpperCamelCase			    =     ['''MMBTForClassification''', '''MMBTModel''', '''ModalEmbeddings''']


if TYPE_CHECKING:
		from .configuration_mmbt import MMBTConfig

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_mmbt import MMBTForClassification, MMBTModel, ModalEmbeddings

else:
		import sys

		UpperCamelCase			    =     _LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)

