
from typing import TYPE_CHECKING

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


_A						      =				{
    "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:
   _A						      =				["FunnelTokenizerFast"]

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   _A						      =				[
       "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:
   _A						      =				[
       "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

   _A						      =				_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)



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


_A						      =				logging.get_logger(__name__)

_A						      =				{
    "sail/poolformer_s12": "https://huggingface.co/sail/poolformer_s12/resolve/main/config.json",
    # See all PoolFormer models at https://huggingface.co/models?filter=poolformer
}







class   lowerCamelCase	(						A_						):
     UpperCAmelCase__       :							Any     =	"poolformer"





     def __init__(self   :					Optional[int]       ,					_A   :					Optional[Any]=3       ,					_A   :					Optional[int]=1_6       ,					_A   :					Dict=1_6       ,					_A   :					Tuple=3       ,					_A   :					Tuple=4.0       ,					_A   :					int=[2, 2, 6, 2]       ,					_A   :					Dict=[6_4, 1_2_8, 3_2_0, 5_1_2]       ,					_A   :					int=[7, 3, 3, 3]       ,					_A   :					List[str]=[4, 2, 2, 2]       ,					_A   :					str=[2, 1, 1, 1]       ,					_A   :					List[Any]=4       ,					_A   :					Any=0.0       ,					_A   :					Optional[Any]="gelu"       ,					_A   :					Optional[Any]=True       ,					_A   :					List[str]=1E-5       ,					_A   :					List[str]=0.02       ,					**_A   :					str       ,					)		->		Tuple:
         snake_case				  =      num_channels
         snake_case				  =      patch_size
         snake_case				  =      stride
         snake_case				  =      padding
         snake_case				  =      pool_size
         snake_case				  =      hidden_sizes
         snake_case				  =      mlp_ratio
         snake_case				  =      depths
         snake_case				  =      patch_sizes
         snake_case				  =      strides
         snake_case				  =      num_encoder_blocks
         snake_case				  =      drop_path_rate
         snake_case				  =      hidden_act
         snake_case				  =      use_layer_scale
         snake_case				  =      layer_scale_init_value
         snake_case				  =      initializer_range
         super().__init__(**_A     )







class   lowerCamelCase	(						A_						):
     UpperCAmelCase__       :							Tuple     =	version.parse("1.11"						)





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





     @property
     def 	UpperCAmelCase(self   :					int     )		->		float:
         return 2E-3

