



"""simple docstring"""

import numpy as np

from transformers import Pipeline
def  __snake_case							(	__A      :						List[Any]     )     ->       Tuple:






				'''simple docstring'''
				SCREAMING_SNAKE_CASE						:							int							=     np.max(__A							,		axis=-1							,		keepdims=__A     )
				SCREAMING_SNAKE_CASE						:							Tuple							=     np.exp(outputs - maxes     )
				return shifted_exp / shifted_exp.sum(axis=-1							,		keepdims=__A     )







class     lowerCAmelCase__						(	_lowerCamelCase ):


	'''simple docstring'''







	def 			_lowerCAmelCase     (      self				:       List[Any]     ,       **_SCREAMING_SNAKE_CASE				:       Optional[Any]    )						->	Tuple:





					"""simple docstring"""


					SCREAMING_SNAKE_CASE						:							Tuple							=     {}
					if "second_text" in kwargs:
									SCREAMING_SNAKE_CASE						:							List[str]							=     kwargs['second_text']
					return preprocess_kwargs, {}, {}





	def 			_lowerCAmelCase     (      self				:       Optional[Any]     ,       _SCREAMING_SNAKE_CASE				:       Optional[Any]     ,       _SCREAMING_SNAKE_CASE				:       str=None    )						->	Any:





					"""simple docstring"""


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





	def 			_lowerCAmelCase     (      self				:       Optional[int]     ,       _SCREAMING_SNAKE_CASE				:       int    )						->	Optional[int]:





					"""simple docstring"""


					return self.model(**_SCREAMING_SNAKE_CASE    )







	def 			_lowerCAmelCase     (      self				:       str     ,       _SCREAMING_SNAKE_CASE				:       int    )						->	List[str]:





					"""simple docstring"""


					SCREAMING_SNAKE_CASE						:							Optional[Any]							=     model_outputs.logits[0].numpy()
					SCREAMING_SNAKE_CASE						:							List[str]							=     softmax(_SCREAMING_SNAKE_CASE    )

					SCREAMING_SNAKE_CASE						:							Optional[int]							=     np.argmax(_SCREAMING_SNAKE_CASE    )
					SCREAMING_SNAKE_CASE						:							str							=     self.model.config.idalabel[best_class]
					SCREAMING_SNAKE_CASE						:							List[str]							=     probabilities[best_class].item()
					SCREAMING_SNAKE_CASE						:							Optional[int]							=     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_						:    Optional[Any]				=      {
    'configuration_squeezebert': [
        'SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP',
        'SqueezeBertConfig',
        'SqueezeBertOnnxConfig',
    ],
    'tokenization_squeezebert': ['SqueezeBertTokenizer'],
}

try:
							if not is_tokenizers_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A_						:    Tuple				=      ['SqueezeBertTokenizerFast']

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							A_						:    int				=      [
							    'SQUEEZEBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
							    'SqueezeBertForMaskedLM',
							    'SqueezeBertForMultipleChoice',
							    'SqueezeBertForQuestionAnswering',
							    'SqueezeBertForSequenceClassification',
							    'SqueezeBertForTokenClassification',
							    'SqueezeBertModel',
							    'SqueezeBertModule',
							    'SqueezeBertPreTrainedModel',
							]


if TYPE_CHECKING:
							from .configuration_squeezebert import (
							    SQUEEZEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP,
							    SqueezeBertConfig,
							    SqueezeBertOnnxConfig,
							)
							from .tokenization_squeezebert import SqueezeBertTokenizer

							try:
														if not is_tokenizers_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_squeezebert_fast import SqueezeBertTokenizerFast

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_squeezebert import (
														    SQUEEZEBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
														    SqueezeBertForMaskedLM,
														    SqueezeBertForMultipleChoice,
														    SqueezeBertForQuestionAnswering,
														    SqueezeBertForSequenceClassification,
														    SqueezeBertForTokenClassification,
														    SqueezeBertModel,
														    SqueezeBertModule,
														    SqueezeBertPreTrainedModel,
														)

else:
							import sys

							A_						:    Optional[Any]				=      _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)





