






"""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


lowerCamelCase_       			=   logging.get_logger(__name__)

lowerCamelCase_       			=   {
    '''microsoft/beit-base-patch16-224-pt22k''': (
        '''https://huggingface.co/microsoft/beit-base-patch16-224-pt22k/resolve/main/config.json'''
    ),
    # See all BEiT models at https://huggingface.co/models?filter=beit
}







class     UpperCamelCase_ (__A  ):
	__magic_name__			   =       '''beit'''





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

				UpperCAmelCase_  :				int      =      vocab_size
				UpperCAmelCase_  :				int      =      hidden_size
				UpperCAmelCase_  :				Tuple      =      num_hidden_layers
				UpperCAmelCase_  :				Any      =      num_attention_heads
				UpperCAmelCase_  :				Any      =      intermediate_size
				UpperCAmelCase_  :				Tuple      =      hidden_act
				UpperCAmelCase_  :				List[str]      =      hidden_dropout_prob
				UpperCAmelCase_  :				int      =      attention_probs_dropout_prob
				UpperCAmelCase_  :				Optional[Any]      =      initializer_range
				UpperCAmelCase_  :				int      =      layer_norm_eps

				UpperCAmelCase_  :				List[Any]      =      image_size
				UpperCAmelCase_  :				str      =      patch_size
				UpperCAmelCase_  :				Union[str, Any]      =      num_channels
				UpperCAmelCase_  :				Optional[int]      =      use_mask_token
				UpperCAmelCase_  :				int      =      use_absolute_position_embeddings
				UpperCAmelCase_  :				List[Any]      =      use_relative_position_bias
				UpperCAmelCase_  :				int      =      use_shared_relative_position_bias
				UpperCAmelCase_  :				List[Any]      =      layer_scale_init_value
				UpperCAmelCase_  :				Union[str, Any]      =      drop_path_rate
				UpperCAmelCase_  :				List[str]      =      use_mean_pooling
				# decode head attributes (semantic segmentation)
				UpperCAmelCase_  :				List[str]      =      out_indices
				UpperCAmelCase_  :				Optional[int]      =      pool_scales
				# auxiliary head attributes (semantic segmentation)
				UpperCAmelCase_  :				Any      =      use_auxiliary_head
				UpperCAmelCase_  :				int      =      auxiliary_loss_weight
				UpperCAmelCase_  :				Union[str, Any]      =      auxiliary_channels
				UpperCAmelCase_  :				Union[str, Any]      =      auxiliary_num_convs
				UpperCAmelCase_  :				Any      =      auxiliary_concat_input
				UpperCAmelCase_  :				Optional[Any]      =      semantic_loss_ignore_index







class     UpperCamelCase_ (__A  ):
	__magic_name__			   =       version.parse('''1.11'''  )





	@property
	def   _SCREAMING_SNAKE_CASE   (   self      :				Tuple		)		->    Mapping[str, Mapping[int, str]]:
				return OrderedDict(
				    [
				        ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
				    ]		)





	@property
	def   _SCREAMING_SNAKE_CASE   (   self      :				List[str]		)		->    float:
				return 1e-4











"""simple docstring"""
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


lowerCamelCase_       			=   logging.getLogger()







@unittest.skip('''Temporarily disable the doc tests.'''  )
@require_torch
@require_tf
@slow
class     UpperCamelCase_ (unittest.TestCase  ):





	def   _SCREAMING_SNAKE_CASE   (   self      :				Union[str, Any]			,			lowerCAmelCase_      :				Path			,			lowerCAmelCase_      :				Union[str, None] = None			,			lowerCAmelCase_      :				Union[List[str], None] = None			,			lowerCAmelCase_      :				Union[str, List[str], None] = None			,			lowerCAmelCase_      :				bool = True			,			)		->    Tuple:
				UpperCAmelCase_  :				Optional[Any]      =      [file for file in os.listdir(lowerCAmelCase_		) if os.path.isfile(os.path.join(lowerCAmelCase_			,			lowerCAmelCase_		)		)]

				if identifier is not None:
							UpperCAmelCase_  :				Optional[int]      =      [file for file in files if identifier in file]

				if n_identifier is not None:
							if isinstance(lowerCAmelCase_			,			lowerCAmelCase_		):
										for n_ in n_identifier:
													UpperCAmelCase_  :				List[Any]      =      [file for file in files if n_ not in file]
							else:
										UpperCAmelCase_  :				Optional[Any]      =      [file for file in files if n_identifier not in file]

				UpperCAmelCase_  :				List[Any]      =      ignore_files or []
				ignore_files.append("__init__.py"		)
				UpperCAmelCase_  :				Optional[Any]      =      [file for file in files if file not in ignore_files]

				for file in files:
							# Open all files
							print("Testing"			,			lowerCAmelCase_		)

							if only_modules:
										UpperCAmelCase_  :				str      =      file.split("."		)[0]
										try:
													UpperCAmelCase_  :				Tuple      =      getattr(lowerCAmelCase_			,			lowerCAmelCase_		)
													UpperCAmelCase_  :				int      =      doctest.DocTestSuite(lowerCAmelCase_		)
													UpperCAmelCase_  :				str      =      unittest.TextTestRunner().run(lowerCAmelCase_		)
													self.assertIs(len(result.failures		)			,			0		)
										except AttributeError:
													logger.info(f"""{module_identifier} is not a module."""		)
							else:
										UpperCAmelCase_  :				List[Any]      =      doctest.testfile(str(".." / directory / file		)			,			optionflags=doctest.ELLIPSIS		)
										self.assertIs(result.failed			,			0		)





	def   _SCREAMING_SNAKE_CASE   (   self      :				Optional[int]		)		->    List[Any]:
				UpperCAmelCase_  :				Optional[int]      =      Path("src/transformers"		)
				UpperCAmelCase_  :				List[Any]      =      "modeling"
				UpperCAmelCase_  :				Tuple      =      [
				    "modeling_ctrl.py",
				    "modeling_tf_ctrl.py",
				]
				self.analyze_directory(lowerCAmelCase_			,			identifier=lowerCAmelCase_			,			ignore_files=lowerCAmelCase_		)





	def   _SCREAMING_SNAKE_CASE   (   self      :				Union[str, Any]		)		->    List[Any]:
				UpperCAmelCase_  :				List[str]      =      Path("src/transformers"		)
				UpperCAmelCase_  :				int      =      "tokenization"
				self.analyze_directory(lowerCAmelCase_			,			identifier=lowerCAmelCase_		)





	def   _SCREAMING_SNAKE_CASE   (   self      :				Optional[Any]		)		->    Optional[Any]:
				UpperCAmelCase_  :				int      =      Path("src/transformers"		)
				UpperCAmelCase_  :				Any      =      "configuration"
				self.analyze_directory(lowerCAmelCase_			,			identifier=lowerCAmelCase_		)





	def   _SCREAMING_SNAKE_CASE   (   self      :				Any		)		->    Any:
				UpperCAmelCase_  :				int      =      Path("src/transformers"		)
				UpperCAmelCase_  :				List[Any]      =      ["configuration", "modeling", "tokenization"]
				self.analyze_directory(lowerCAmelCase_			,			n_identifier=lowerCAmelCase_		)





	def   _SCREAMING_SNAKE_CASE   (   self      :				List[str]		)		->    Dict:
				UpperCAmelCase_  :				List[str]      =      Path("docs/source"		)
				UpperCAmelCase_  :				int      =      ["favicon.ico"]
				self.analyze_directory(lowerCAmelCase_			,			ignore_files=lowerCAmelCase_			,			only_modules=lowerCAmelCase_		)



