




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


lowerCamelCase__			:       List[Any]         =							logging.get_logger(__name__)

lowerCamelCase__			:       Optional[int]         =							{
    'facebook/data2vec-vision-base-ft': (
        'https://huggingface.co/facebook/data2vec-vision-base-ft/resolve/main/config.json'
    ),
}





class 	lowerCamelCase_							(				_SCREAMING_SNAKE_CASE ):


 '''simple docstring'''







 lowercase_       =   "data2vec-vision"



 def __init__(							self  :		str    ,    _lowerCAmelCase  :		Optional[Any]=768    ,    _lowerCAmelCase  :		Optional[int]=12    ,    _lowerCAmelCase  :		Tuple=12    ,    _lowerCAmelCase  :		str=3_072    ,    _lowerCAmelCase  :		List[Any]="gelu"    ,    _lowerCAmelCase  :		List[Any]=0.0    ,    _lowerCAmelCase  :		Optional[Any]=0.0    ,    _lowerCAmelCase  :		str=0.02    ,    _lowerCAmelCase  :		Optional[int]=1E-12    ,    _lowerCAmelCase  :		Tuple=224    ,    _lowerCAmelCase  :		Dict=16    ,    _lowerCAmelCase  :		str=3    ,    _lowerCAmelCase  :		List[str]=False    ,    _lowerCAmelCase  :		Optional[Any]=False    ,    _lowerCAmelCase  :		Dict=False    ,    _lowerCAmelCase  :		Tuple=False    ,    _lowerCAmelCase  :		Optional[int]=0.1    ,    _lowerCAmelCase  :		List[str]=0.1    ,    _lowerCAmelCase  :		Any=True    ,    _lowerCAmelCase  :		Dict=[3, 5, 7, 11]    ,    _lowerCAmelCase  :		List[str]=[1, 2, 3, 6]    ,    _lowerCAmelCase  :		Tuple=True    ,    _lowerCAmelCase  :		Optional[int]=0.4    ,    _lowerCAmelCase  :		Dict=256    ,    _lowerCAmelCase  :		int=1    ,    _lowerCAmelCase  :		Optional[Any]=False    ,    _lowerCAmelCase  :		Union[str, Any]=255    ,    **_lowerCAmelCase  :		int    ,    ):
       super().__init__(**_lowerCAmelCase						)

       SCREAMING_SNAKE_CASE_     						=      hidden_size
       SCREAMING_SNAKE_CASE_     						=      num_hidden_layers
       SCREAMING_SNAKE_CASE_     						=      num_attention_heads
       SCREAMING_SNAKE_CASE_     						=      intermediate_size
       SCREAMING_SNAKE_CASE_     						=      hidden_act
       SCREAMING_SNAKE_CASE_     						=      hidden_dropout_prob
       SCREAMING_SNAKE_CASE_     						=      attention_probs_dropout_prob
       SCREAMING_SNAKE_CASE_     						=      initializer_range
       SCREAMING_SNAKE_CASE_     						=      layer_norm_eps

       SCREAMING_SNAKE_CASE_     						=      image_size
       SCREAMING_SNAKE_CASE_     						=      patch_size
       SCREAMING_SNAKE_CASE_     						=      num_channels
       SCREAMING_SNAKE_CASE_     						=      use_mask_token
       SCREAMING_SNAKE_CASE_     						=      use_absolute_position_embeddings
       SCREAMING_SNAKE_CASE_     						=      use_relative_position_bias
       SCREAMING_SNAKE_CASE_     						=      use_shared_relative_position_bias
       SCREAMING_SNAKE_CASE_     						=      layer_scale_init_value
       SCREAMING_SNAKE_CASE_     						=      drop_path_rate
       SCREAMING_SNAKE_CASE_     						=      use_mean_pooling
       # decode head attributes (semantic segmentation)
       SCREAMING_SNAKE_CASE_     						=      out_indices
       SCREAMING_SNAKE_CASE_     						=      pool_scales
       # auxiliary head attributes (semantic segmentation)
       SCREAMING_SNAKE_CASE_     						=      use_auxiliary_head
       SCREAMING_SNAKE_CASE_     						=      auxiliary_loss_weight
       SCREAMING_SNAKE_CASE_     						=      auxiliary_channels
       SCREAMING_SNAKE_CASE_     						=      auxiliary_num_convs
       SCREAMING_SNAKE_CASE_     						=      auxiliary_concat_input
       SCREAMING_SNAKE_CASE_     						=      semantic_loss_ignore_index





class 	lowerCamelCase_							(				_SCREAMING_SNAKE_CASE ):


 '''simple docstring'''







 lowercase_       =   version.parse("1.11" )



 @property
 def 				lowerCAmelCase_  (							self  :		Optional[int]						):
       return OrderedDict(
           [
               ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
           ]						)




 @property
 def 				lowerCAmelCase_  (							self  :		Tuple						):
       return 1E-4





from packaging import version

from .import_utils import is_accelerate_available


if is_accelerate_available():
   import accelerate

def  UpperCAmelCase_							(				__UpperCAmelCase						:     Optional[int]							) ->			int:
      if not is_accelerate_available():
            return method
      SCREAMING_SNAKE_CASE_     						=      version.parse(accelerate.__version__							).base_version
      if version.parse(__UpperCAmelCase							) < version.parse('0.17.0'							):
            return method

      def wrapper(self						:     Optional[int]      ,      *__UpperCAmelCase						:     Optional[Any]      ,      **__UpperCAmelCase						:     Optional[Any]							):
            if hasattr(self      ,      '_hf_hook'							) and hasattr(self._hf_hook      ,      'pre_forward'							):
                  self._hf_hook.pre_forward(self							)
            return method(self      ,      *__UpperCAmelCase      ,      **__UpperCAmelCase							)

      return wrapper