




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


a													=			logging.get_logger(__name__)

a													=			{
    "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       _A				(		__lowercase     ):
		__a					    =       """cvt"""






		def __init__(    self						,		_SCREAMING_SNAKE_CASE=3						,		_SCREAMING_SNAKE_CASE=[7, 3, 3]						,		_SCREAMING_SNAKE_CASE=[4, 2, 2]						,		_SCREAMING_SNAKE_CASE=[2, 1, 1]						,		_SCREAMING_SNAKE_CASE=[64, 192, 384]						,		_SCREAMING_SNAKE_CASE=[1, 3, 6]						,		_SCREAMING_SNAKE_CASE=[1, 2, 10]						,		_SCREAMING_SNAKE_CASE=[4.0, 4.0, 4.0]						,		_SCREAMING_SNAKE_CASE=[0.0, 0.0, 0.0]						,		_SCREAMING_SNAKE_CASE=[0.0, 0.0, 0.0]						,		_SCREAMING_SNAKE_CASE=[0.0, 0.0, 0.1]						,		_SCREAMING_SNAKE_CASE=[True, True, True]						,		_SCREAMING_SNAKE_CASE=[False, False, True]						,		_SCREAMING_SNAKE_CASE=["dw_bn", "dw_bn", "dw_bn"]						,		_SCREAMING_SNAKE_CASE=[3, 3, 3]						,		_SCREAMING_SNAKE_CASE=[1, 1, 1]						,		_SCREAMING_SNAKE_CASE=[2, 2, 2]						,		_SCREAMING_SNAKE_CASE=[1, 1, 1]						,		_SCREAMING_SNAKE_CASE=[1, 1, 1]						,		_SCREAMING_SNAKE_CASE=0.02						,		_SCREAMING_SNAKE_CASE=1e-12						,		**_SCREAMING_SNAKE_CASE						,		):
								super().__init__(**_SCREAMING_SNAKE_CASE			)
								_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





from typing import Dict

from .base import GenericTensor, Pipeline




class       _A				(		__lowercase     ):






		def 				UpperCAmelCase (    self						,		_SCREAMING_SNAKE_CASE=None						,		_SCREAMING_SNAKE_CASE=None						,		_SCREAMING_SNAKE_CASE=None						,		**_SCREAMING_SNAKE_CASE			):
								if tokenize_kwargs is None:
														_UpperCAmelCase      =			{}

								if truncation is not None:
														if "truncation" in tokenize_kwargs:
																				raise ValueError(
																				    """truncation parameter defined twice (given as keyword argument as well as in tokenize_kwargs)"""			)
														_UpperCAmelCase      =			truncation

								_UpperCAmelCase      =			tokenize_kwargs

								_UpperCAmelCase      =			{}
								if return_tensors is not None:
														_UpperCAmelCase      =			return_tensors

								return preprocess_params, {}, postprocess_params






		def 				UpperCAmelCase (    self						,		_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			):
								_UpperCAmelCase      =			self.framework
								_UpperCAmelCase      =			self.tokenizer(_SCREAMING_SNAKE_CASE						,		return_tensors=_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			)
								return model_inputs






		def 				UpperCAmelCase (    self						,		_SCREAMING_SNAKE_CASE			):
								_UpperCAmelCase      =			self.model(**_SCREAMING_SNAKE_CASE			)
								return model_outputs






		def 				UpperCAmelCase (    self						,		_SCREAMING_SNAKE_CASE						,		_SCREAMING_SNAKE_CASE=False			):
								# [0] is the first available tensor, logits or last_hidden_state.
								if return_tensors:
														return model_outputs[0]
								if self.framework == "pt":
														return model_outputs[0].tolist()
								elif self.framework == "tf":
														return model_outputs[0].numpy().tolist()






		def __call__(    self						,		*_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			):
								return super().__call__(*_SCREAMING_SNAKE_CASE						,		**_SCREAMING_SNAKE_CASE			)