


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_      : str  					=       logging.get_logger(__name__)

UpperCAmelCase_      : Any  					=       {
    '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  SCREAMING_SNAKE_CASE__  (				lowercase__			):
      snake_case__				:     Tuple        =						'''beit'''
      def __init__(       self				:       Dict     ,							SCREAMING_SNAKE_CASE__				:       Any=8_1_9_2     ,							SCREAMING_SNAKE_CASE__				:       Tuple=7_6_8     ,							SCREAMING_SNAKE_CASE__				:       Any=1_2     ,							SCREAMING_SNAKE_CASE__				:       str=1_2     ,							SCREAMING_SNAKE_CASE__				:       Any=3_0_7_2     ,							SCREAMING_SNAKE_CASE__				:       Optional[int]="gelu"     ,							SCREAMING_SNAKE_CASE__				:       str=0.0     ,							SCREAMING_SNAKE_CASE__				:       Union[str, Any]=0.0     ,							SCREAMING_SNAKE_CASE__				:       List[str]=0.02     ,							SCREAMING_SNAKE_CASE__				:       Optional[int]=1E-12     ,							SCREAMING_SNAKE_CASE__				:       Any=2_2_4     ,							SCREAMING_SNAKE_CASE__				:       List[Any]=1_6     ,							SCREAMING_SNAKE_CASE__				:       Dict=3     ,							SCREAMING_SNAKE_CASE__				:       Dict=False     ,							SCREAMING_SNAKE_CASE__				:       List[Any]=False     ,							SCREAMING_SNAKE_CASE__				:       str=False     ,							SCREAMING_SNAKE_CASE__				:       str=False     ,							SCREAMING_SNAKE_CASE__				:       Dict=0.1     ,							SCREAMING_SNAKE_CASE__				:       Dict=0.1     ,							SCREAMING_SNAKE_CASE__				:       int=True     ,							SCREAMING_SNAKE_CASE__				:       Optional[Any]=[3, 5, 7, 1_1]     ,							SCREAMING_SNAKE_CASE__				:       Union[str, Any]=[1, 2, 3, 6]     ,							SCREAMING_SNAKE_CASE__				:       List[str]=True     ,							SCREAMING_SNAKE_CASE__				:       Any=0.4     ,							SCREAMING_SNAKE_CASE__				:       Any=2_5_6     ,							SCREAMING_SNAKE_CASE__				:       Any=1     ,							SCREAMING_SNAKE_CASE__				:       Optional[int]=False     ,							SCREAMING_SNAKE_CASE__				:       List[Any]=2_5_5     ,							**SCREAMING_SNAKE_CASE__				:       Optional[Any]     ,							)		->			str:
             super().__init__(**SCREAMING_SNAKE_CASE__     )

             a_					:		Union[str, Any]							=  vocab_size
             a_					:		str							=  hidden_size
             a_					:		int							=  num_hidden_layers
             a_					:		Any							=  num_attention_heads
             a_					:		Any							=  intermediate_size
             a_					:		Optional[Any]							=  hidden_act
             a_					:		str							=  hidden_dropout_prob
             a_					:		List[Any]							=  attention_probs_dropout_prob
             a_					:		Optional[Any]							=  initializer_range
             a_					:		Any							=  layer_norm_eps

             a_					:		Dict							=  image_size
             a_					:		List[str]							=  patch_size
             a_					:		Optional[int]							=  num_channels
             a_					:		str							=  use_mask_token
             a_					:		Optional[int]							=  use_absolute_position_embeddings
             a_					:		Union[str, Any]							=  use_relative_position_bias
             a_					:		Optional[Any]							=  use_shared_relative_position_bias
             a_					:		Optional[int]							=  layer_scale_init_value
             a_					:		str							=  drop_path_rate
             a_					:		Tuple							=  use_mean_pooling
             # decode head attributes (semantic segmentation)
             a_					:		str							=  out_indices
             a_					:		List[str]							=  pool_scales
             # auxiliary head attributes (semantic segmentation)
             a_					:		Optional[int]							=  use_auxiliary_head
             a_					:		Optional[Any]							=  auxiliary_loss_weight
             a_					:		List[str]							=  auxiliary_channels
             a_					:		List[str]							=  auxiliary_num_convs
             a_					:		Dict							=  auxiliary_concat_input
             a_					:		str							=  semantic_loss_ignore_index
class  SCREAMING_SNAKE_CASE__  (				lowercase__			):
      snake_case__				:     Dict        =						version.parse('''1.11'''			)
      @property
      def        SCREAMING_SNAKE_CASE							(       self				:       List[Any]     )		->			Mapping[str, Mapping[int, str]]:
             return OrderedDict(
                 [
                     ('pixel_values', {0: 'batch', 1: 'num_channels', 2: 'height', 3: 'width'}),
                 ]     )

      @property
      def        SCREAMING_SNAKE_CASE							(       self				:       Union[str, Any]     )		->			float:
             return 1E-4




from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


lowercase  :					str						    =							{
    """configuration_funnel""": ["""FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP""", """FunnelConfig"""],
    """convert_funnel_original_tf_checkpoint_to_pytorch""": [],
    """tokenization_funnel""": ["""FunnelTokenizer"""],
}

try:
  if not is_tokenizers_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase  :					Tuple						    =							["""FunnelTokenizerFast"""]

try:
  if not is_torch_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase  :					List[str]						    =							[
      """FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """FunnelBaseModel""",
      """FunnelForMaskedLM""",
      """FunnelForMultipleChoice""",
      """FunnelForPreTraining""",
      """FunnelForQuestionAnswering""",
      """FunnelForSequenceClassification""",
      """FunnelForTokenClassification""",
      """FunnelModel""",
      """FunnelPreTrainedModel""",
      """load_tf_weights_in_funnel""",
  ]

try:
  if not is_tf_available():
    raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
  pass
else:
  lowercase  :					Optional[Any]						    =							[
      """TF_FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST""",
      """TFFunnelBaseModel""",
      """TFFunnelForMaskedLM""",
      """TFFunnelForMultipleChoice""",
      """TFFunnelForPreTraining""",
      """TFFunnelForQuestionAnswering""",
      """TFFunnelForSequenceClassification""",
      """TFFunnelForTokenClassification""",
      """TFFunnelModel""",
      """TFFunnelPreTrainedModel""",
  ]


if TYPE_CHECKING:
  from .configuration_funnel import FUNNEL_PRETRAINED_CONFIG_ARCHIVE_MAP, FunnelConfig
  from .tokenization_funnel import FunnelTokenizer

  try:
    if not is_tokenizers_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .tokenization_funnel_fast import FunnelTokenizerFast

  try:
    if not is_torch_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_funnel import (
        FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST,
        FunnelBaseModel,
        FunnelForMaskedLM,
        FunnelForMultipleChoice,
        FunnelForPreTraining,
        FunnelForQuestionAnswering,
        FunnelForSequenceClassification,
        FunnelForTokenClassification,
        FunnelModel,
        FunnelPreTrainedModel,
        load_tf_weights_in_funnel,
    )

  try:
    if not is_tf_available():
      raise OptionalDependencyNotAvailable()
  except OptionalDependencyNotAvailable:
    pass
  else:
    from .modeling_tf_funnel import (
        TF_FUNNEL_PRETRAINED_MODEL_ARCHIVE_LIST,
        TFFunnelBaseModel,
        TFFunnelForMaskedLM,
        TFFunnelForMultipleChoice,
        TFFunnelForPreTraining,
        TFFunnelForQuestionAnswering,
        TFFunnelForSequenceClassification,
        TFFunnelForTokenClassification,
        TFFunnelModel,
        TFFunnelPreTrainedModel,
    )

else:
  import sys

  lowercase  :					Any						    =							_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)
