


"""simple docstring"""



from typing import Dict

from .base import GenericTensor, Pipeline
class 					__magic_name__		(			lowercase__     ):






       def  __snake_case						(   self  :    Tuple  ,     snake_case__  :    str=None  ,     snake_case__  :    Optional[Any]=None  ,     snake_case__  :    Tuple=None  ,     **snake_case__  :    int				):

              '''simple docstring'''






              if tokenize_kwargs is None:
                     lowercase		:Optional[int]       							=				{}

              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)'''				)
                     lowercase		:List[str]       							=				truncation

              lowercase		:Optional[Any]       							=				tokenize_kwargs

              lowercase		:Optional[Any]       							=				{}
              if return_tensors is not None:
                     lowercase		:str       							=				return_tensors

              return preprocess_params, {}, postprocess_params






       def  __snake_case						(   self  :    int  ,     snake_case__  :    Optional[Any]  ,     **snake_case__  :    Optional[int]				):

              '''simple docstring'''






              lowercase		:List[str]       							=				self.framework
              lowercase		:List[Any]       							=				self.tokenizer(__lowerCamelCase  ,     return_tensors=__lowerCamelCase  ,     **__lowerCamelCase				)
              return model_inputs






       def  __snake_case						(   self  :    Tuple  ,     snake_case__  :    Optional[int]				):

              '''simple docstring'''






              lowercase		:List[Any]       							=				self.model(**__lowerCamelCase				)
              return model_outputs






       def  __snake_case						(   self  :    int  ,     snake_case__  :    Optional[Any]  ,     snake_case__  :    List[str]=False				):

              '''simple docstring'''






              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  :    Optional[int]  ,     *snake_case__  :    Union[str, Any]  ,     **snake_case__  :    List[Any]				):

              '''simple docstring'''






              return super().__call__(*__lowerCamelCase  ,     **__lowerCamelCase				)










"""simple docstring"""



from collections import OrderedDict
from typing import Mapping

from packaging import version

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


UpperCAmelCase      		=			logging.get_logger(__name__)

UpperCAmelCase      		=			{
    '''facebook/deit-base-distilled-patch16-224''': (
        '''https://huggingface.co/facebook/deit-base-patch16-224/resolve/main/config.json'''
    ),
    # See all DeiT models at https://huggingface.co/models?filter=deit
}
class 					__magic_name__		(			__UpperCAmelCase     ):
       __A			:      Tuple        =   "deit"






       def __init__(   self  :    List[str]  ,     snake_case__  :    int=7_6_8  ,     snake_case__  :    List[Any]=1_2  ,     snake_case__  :    Dict=1_2  ,     snake_case__  :    List[Any]=3_0_7_2  ,     snake_case__  :    Optional[int]="gelu"  ,     snake_case__  :    Dict=0.0  ,     snake_case__  :    str=0.0  ,     snake_case__  :    List[str]=0.02  ,     snake_case__  :    Optional[int]=1e-1_2  ,     snake_case__  :    Any=2_2_4  ,     snake_case__  :    Optional[int]=1_6  ,     snake_case__  :    int=3  ,     snake_case__  :    str=True  ,     snake_case__  :    Optional[int]=1_6  ,     **snake_case__  :    List[Any]  ,     ):

              '''simple docstring'''






              super().__init__(**snake_case__				)

              lowercase		:List[str]       							=				hidden_size
              lowercase		:Union[str, Any]       							=				num_hidden_layers
              lowercase		:Optional[Any]       							=				num_attention_heads
              lowercase		:Optional[Any]       							=				intermediate_size
              lowercase		:int       							=				hidden_act
              lowercase		:int       							=				hidden_dropout_prob
              lowercase		:Dict       							=				attention_probs_dropout_prob
              lowercase		:Optional[int]       							=				initializer_range
              lowercase		:Tuple       							=				layer_norm_eps
              lowercase		:Optional[int]       							=				image_size
              lowercase		:Union[str, Any]       							=				patch_size
              lowercase		:Optional[Any]       							=				num_channels
              lowercase		:Tuple       							=				qkv_bias
              lowercase		:Optional[Any]       							=				encoder_stride







class 					__magic_name__		(			__UpperCAmelCase     ):
       __A			:      Optional[int]        =   version.parse("1.11"     )






       @property
       def  __snake_case						(   self  :    int				):

              '''simple docstring'''






              return OrderedDict(
                  [
                      ('''pixel_values''', {0: '''batch''', 1: '''num_channels''', 2: '''height''', 3: '''width'''}),
                  ]				)







       @property
       def  __snake_case						(   self  :    Optional[int]				):

              '''simple docstring'''






              return 1e-4

