



import numpy as np

from transformers import Pipeline

def      __lowercase					( snake_case ):







				"""simple docstring"""






				__magic_name__		:List[Any]        =      np.max(__UpperCamelCase,  axis=-1,  keepdims=__UpperCamelCase )
				__magic_name__		:List[Any]        =      np.exp(outputs - maxes )
				return shifted_exp / shifted_exp.sum(axis=-1,  keepdims=__UpperCamelCase )

class 						lowerCamelCase_				(      UpperCAmelCase_ ):







				def 			A	(						self       ,					**__lowerCAmelCase     ):
								"""simple docstring"""
								__magic_name__		:List[str]        =      {}
								if "second_text" in kwargs:
												__magic_name__		:Dict        =      kwargs['''second_text''']
								return preprocess_kwargs, {}, {}







				def 			A	(						self       ,					__lowerCAmelCase       ,					__lowerCAmelCase=None     ):
								"""simple docstring"""
								return self.tokenizer(_snake_case       ,					text_pair=_snake_case       ,					return_tensors=self.framework     )







				def 			A	(						self       ,					__lowerCAmelCase     ):
								"""simple docstring"""
								return self.model(**_snake_case     )







				def 			A	(						self       ,					__lowerCAmelCase     ):
								"""simple docstring"""
								__magic_name__		:int        =      model_outputs.logits[0].numpy()
								__magic_name__		:Tuple        =      softmax(_snake_case     )

								__magic_name__		:Dict        =      np.argmax(_snake_case     )
								__magic_name__		:Tuple        =      self.model.config.idalabel[best_class]
								__magic_name__		:List[str]        =      probabilities[best_class].item()
								__magic_name__		:List[str]        =      logits.tolist()
								return {"label": label, "score": score, "logits": logits}














from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available


SCREAMING_SNAKE_CASE__      :			Union[str, Any]							=		{"""tokenization_herbert""": ["""HerbertTokenizer"""]}

try:
					if not is_tokenizers_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					SCREAMING_SNAKE_CASE__      :			Optional[Any]							=		["""HerbertTokenizerFast"""]


if TYPE_CHECKING:
					from .tokenization_herbert import HerbertTokenizer

					try:
										if not is_tokenizers_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .tokenization_herbert_fast import HerbertTokenizerFast

else:
					import sys

					SCREAMING_SNAKE_CASE__      :			Union[str, Any]							=		_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)






