






'''simple docstring'''


from ...configuration_utils import PretrainedConfig
from ...utils import logging


lowerCamelCase_				: int    	=							logging.get_logger(__name__)

lowerCamelCase_				: Tuple    	=							{
    '''microsoft/cvt-13''': '''https://huggingface.co/microsoft/cvt-13/resolve/main/config.json''',
    # See all Cvt models at https://huggingface.co/models?filter=cvt
}
class    _SCREAMING_SNAKE_CASE							(		SCREAMING_SNAKE_CASE	):
			__a							:							Union[str, Any]					     =					"cvt"






			def __init__(   self							:						List[str] ,      lowercase							:						int=3 ,      lowercase							:						Union[str, Any]=[7, 3, 3] ,      lowercase							:						Optional[Any]=[4, 2, 2] ,      lowercase							:						str=[2, 1, 1] ,      lowercase							:						Tuple=[6_4, 1_9_2, 3_8_4] ,      lowercase							:						Union[str, Any]=[1, 3, 6] ,      lowercase							:						Optional[int]=[1, 2, 1_0] ,      lowercase							:						Dict=[4.0, 4.0, 4.0] ,      lowercase							:						int=[0.0, 0.0, 0.0] ,      lowercase							:						Dict=[0.0, 0.0, 0.0] ,      lowercase							:						Optional[Any]=[0.0, 0.0, 0.1] ,      lowercase							:						Optional[Any]=[True, True, True] ,      lowercase							:						str=[False, False, True] ,      lowercase							:						List[str]=["dw_bn", "dw_bn", "dw_bn"] ,      lowercase							:						Any=[3, 3, 3] ,      lowercase							:						List[Any]=[1, 1, 1] ,      lowercase							:						List[Any]=[2, 2, 2] ,      lowercase							:						List[str]=[1, 1, 1] ,      lowercase							:						Optional[Any]=[1, 1, 1] ,      lowercase							:						int=0.0_2 ,      lowercase							:						Dict=1e-12 ,      **lowercase							:						List[str] ,      )							->    List[str]:

									'''simple docstring'''







									super().__init__(**lowercase			)
									UpperCamelCase__         = num_channels
									UpperCamelCase__         = patch_sizes
									UpperCamelCase__         = patch_stride
									UpperCamelCase__         = patch_padding
									UpperCamelCase__         = embed_dim
									UpperCamelCase__         = num_heads
									UpperCamelCase__         = depth
									UpperCamelCase__         = mlp_ratio
									UpperCamelCase__         = attention_drop_rate
									UpperCamelCase__         = drop_rate
									UpperCamelCase__         = drop_path_rate
									UpperCamelCase__         = qkv_bias
									UpperCamelCase__         = cls_token
									UpperCamelCase__         = qkv_projection_method
									UpperCamelCase__         = kernel_qkv
									UpperCamelCase__         = padding_kv
									UpperCamelCase__         = stride_kv
									UpperCamelCase__         = padding_q
									UpperCamelCase__         = stride_q
									UpperCamelCase__         = initializer_range
									UpperCamelCase__         = layer_norm_eps








'''simple docstring'''


import numpy as np

from transformers import Pipeline







def 	__magic_name__( _A					):
						'''simple docstring'''





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







class    _SCREAMING_SNAKE_CASE							(		SCREAMING_SNAKE_CASE	):


			'''simple docstring'''





			def 				A      (   self							:						int ,      **lowercase							:						List[Any]			)							->    List[str]:

									'''simple docstring'''







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






			def 				A      (   self							:						Optional[int] ,      lowercase							:						Union[str, Any] ,      lowercase							:						Any=None			)							->    Optional[int]:

									'''simple docstring'''







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






			def 				A      (   self							:						Union[str, Any] ,      lowercase							:						Optional[int]			)							->    Any:

									'''simple docstring'''







									return self.model(**lowercase			)







			def 				A      (   self							:						List[str] ,      lowercase							:						Any			)							->    Optional[int]:

									'''simple docstring'''







									UpperCamelCase__         = model_outputs.logits[0].numpy()
									UpperCamelCase__         = softmax(lowercase			)

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