






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					:		Optional[Any]	  =						logging.get_logger(__name__)

__UpperCamelCase					:		Tuple	  =						{
    """facebook/data2vec-vision-base-ft""": (
        """https://huggingface.co/facebook/data2vec-vision-base-ft/resolve/main/config.json"""
    ),
}


class   __SCREAMING_SNAKE_CASE(	a_	):
							_UpperCAmelCase     =       "data2vec-vision"
							def __init__(     self:      Dict       ,	UpperCamelCase:      int=7_68       ,	UpperCamelCase:      Any=12       ,	UpperCamelCase:      Dict=12       ,	UpperCamelCase:      Tuple=30_72       ,	UpperCamelCase:      Any="gelu"       ,	UpperCamelCase:      List[str]=0.0       ,	UpperCamelCase:      List[str]=0.0       ,	UpperCamelCase:      Dict=0.02       ,	UpperCamelCase:      List[Any]=1e-12       ,	UpperCamelCase:      Optional[int]=2_24       ,	UpperCamelCase:      int=16       ,	UpperCamelCase:      List[str]=3       ,	UpperCamelCase:      Dict=False       ,	UpperCamelCase:      Union[str, Any]=False       ,	UpperCamelCase:      Tuple=False       ,	UpperCamelCase:      List[str]=False       ,	UpperCamelCase:      Any=0.1       ,	UpperCamelCase:      List[str]=0.1       ,	UpperCamelCase:      Optional[Any]=True       ,	UpperCamelCase:      List[str]=[3, 5, 7, 11]       ,	UpperCamelCase:      Tuple=[1, 2, 3, 6]       ,	UpperCamelCase:      Any=True       ,	UpperCamelCase:      List[Any]=0.4       ,	UpperCamelCase:      Optional[int]=2_56       ,	UpperCamelCase:      Optional[int]=1       ,	UpperCamelCase:      str=False       ,	UpperCamelCase:      List[Any]=2_55       ,	**UpperCamelCase:      Optional[Any]       ,	)		->		Optional[Any]:
											super().__init__(**UpperCamelCase						)

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

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


class   __SCREAMING_SNAKE_CASE(	a_	):
							_UpperCAmelCase     =       version.parse("1.11"	)
							@property
							def lowerCAmelCase_ (     self:      Tuple						)		->		Mapping[str, Mapping[int, str]]:
											return OrderedDict(
											    [
											        ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
											    ]						)


							@property
							def lowerCAmelCase_ (     self:      Dict						)		->		float:
											return 1e-4












import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union

import transformers
from transformers.testing_utils import require_tf, require_torch, slow


__UpperCamelCase					:		Optional[Any]	  =						logging.getLogger()


@unittest.skip("Temporarily disable the doc tests."	)
@require_torch
@require_tf
@slow
class   __SCREAMING_SNAKE_CASE(	unittest.TestCase	):
							def lowerCAmelCase_ (     self:      Dict       ,	UpperCamelCase:      Path       ,	UpperCamelCase:      Union[str, None] = None       ,	UpperCamelCase:      Union[List[str], None] = None       ,	UpperCamelCase:      Union[str, List[str], None] = None       ,	UpperCamelCase:      bool = True       ,	)		->		int:
											snake_case__									=     [file for file in os.listdir(UpperCamelCase						) if os.path.isfile(os.path.join(UpperCamelCase       ,	UpperCamelCase						)						)]

											if identifier is not None:
															snake_case__									=     [file for file in files if identifier in file]

											if n_identifier is not None:
															if isinstance(UpperCamelCase       ,	UpperCamelCase						):
																			for n_ in n_identifier:
																							snake_case__									=     [file for file in files if n_ not in file]
															else:
																			snake_case__									=     [file for file in files if n_identifier not in file]

											snake_case__									=     ignore_files or []
											ignore_files.append('__init__.py'						)
											snake_case__									=     [file for file in files if file not in ignore_files]

											for file in files:
															# Open all files
															print('Testing'       ,	UpperCamelCase						)

															if only_modules:
																			snake_case__									=     file.split('.'						)[0]
																			try:
																							snake_case__									=     getattr(UpperCamelCase       ,	UpperCamelCase						)
																							snake_case__									=     doctest.DocTestSuite(UpperCamelCase						)
																							snake_case__									=     unittest.TextTestRunner().run(UpperCamelCase						)
																							self.assertIs(len(result.failures						)       ,	0						)
																			except AttributeError:
																							logger.info(F'''{module_identifier} is not a module.'''						)
															else:
																			snake_case__									=     doctest.testfile(str('..' / directory / file						)       ,	optionflags=doctest.ELLIPSIS						)
																			self.assertIs(result.failed       ,	0						)
							def lowerCAmelCase_ (     self:      Tuple						)		->		int:
											snake_case__									=     Path('src/transformers'						)
											snake_case__									=     'modeling'
											snake_case__									=     [
											    'modeling_ctrl.py',
											    'modeling_tf_ctrl.py',
											]
											self.analyze_directory(UpperCamelCase       ,	identifier=UpperCamelCase       ,	ignore_files=UpperCamelCase						)
							def lowerCAmelCase_ (     self:      Optional[int]						)		->		str:
											snake_case__									=     Path('src/transformers'						)
											snake_case__									=     'tokenization'
											self.analyze_directory(UpperCamelCase       ,	identifier=UpperCamelCase						)
							def lowerCAmelCase_ (     self:      Optional[Any]						)		->		int:
											snake_case__									=     Path('src/transformers'						)
											snake_case__									=     'configuration'
											self.analyze_directory(UpperCamelCase       ,	identifier=UpperCamelCase						)
							def lowerCAmelCase_ (     self:      Dict						)		->		List[Any]:
											snake_case__									=     Path('src/transformers'						)
											snake_case__									=     ['configuration', 'modeling', 'tokenization']
											self.analyze_directory(UpperCamelCase       ,	n_identifier=UpperCamelCase						)


							def lowerCAmelCase_ (     self:      Tuple						)		->		Union[str, Any]:
											snake_case__									=     Path('docs/source'						)
											snake_case__									=     ['favicon.ico']
											self.analyze_directory(UpperCamelCase       ,	ignore_files=UpperCamelCase       ,	only_modules=UpperCamelCase						)




