
"""simple docstring"""







import numpy as np

from transformers import Pipeline
def    __lowerCAmelCase    (_UpperCamelCase		):
	__lowerCAmelCase      :						Union[str, Any]						      =				np.max(_lowerCAmelCase	,  axis=-1	,  keepdims=_lowerCAmelCase		)
	__lowerCAmelCase      :						str						      =				np.exp(outputs - maxes		)
	return shifted_exp / shifted_exp.sum(axis=-1	,  keepdims=_lowerCAmelCase		)




class 			A__	(     _lowerCamelCase):

		def 							__lowerCamelCase							(				self	,		**_SCREAMING_SNAKE_CASE			):
			__lowerCAmelCase      :						List[Any]						      =				{}
			if "second_text" in kwargs:
				__lowerCAmelCase      :						List[str]						      =				kwargs['second_text']
			return preprocess_kwargs, {}, {}

		def 							__lowerCamelCase							(				self	,		_SCREAMING_SNAKE_CASE	,		_SCREAMING_SNAKE_CASE=None			):
			return self.tokenizer(_lowerCAmelCase	,		text_pair=_lowerCAmelCase	,		return_tensors=self.framework			)

		def 							__lowerCamelCase							(				self	,		_SCREAMING_SNAKE_CASE			):
			return self.model(**_lowerCAmelCase			)







		def 							__lowerCamelCase							(				self	,		_SCREAMING_SNAKE_CASE			):
			__lowerCAmelCase      :						Dict						      =				model_outputs.logits[0].numpy()
			__lowerCAmelCase      :						Dict						      =				softmax(_lowerCAmelCase			)

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

"""simple docstring"""







from .glue import glue_convert_examples_to_features, glue_output_modes, glue_processors, glue_tasks_num_labels
from .squad import SquadExample, SquadFeatures, SquadVaProcessor, SquadVaProcessor, squad_convert_examples_to_features
from .utils import DataProcessor, InputExample, InputFeatures, SingleSentenceClassificationProcessor
from .xnli import xnli_output_modes, xnli_processors, xnli_tasks_num_labels