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

a  :      Any            =    {
    """facebook/levit-128S""": """https://huggingface.co/facebook/levit-128S/resolve/main/config.json""",
    # See all LeViT models at https://huggingface.co/models?filter=levit
}

class 					_lowercase    (     UpperCAmelCase__			):






    '''simple docstring'''
    SCREAMING_SNAKE_CASE:				Tuple          =    'levit'




    def __init__(    self       ,						lowerCamelCase__=224       ,						lowerCamelCase__=3       ,						lowerCamelCase__=3       ,						lowerCamelCase__=2       ,						lowerCamelCase__=1       ,						lowerCamelCase__=16       ,						lowerCamelCase__=[128, 256, 384]       ,						lowerCamelCase__=[4, 8, 12]       ,						lowerCamelCase__=[4, 4, 4]       ,						lowerCamelCase__=[16, 16, 16]       ,						lowerCamelCase__=0       ,						lowerCamelCase__=[2, 2, 2]       ,						lowerCamelCase__=[2, 2, 2]       ,						lowerCamelCase__=0.0_2       ,						**lowerCamelCase__       ,						):
       super().__init__(**lowerCamelCase__ )
       lowerCAmelCase_:							Tuple       =	image_size
       lowerCAmelCase_:							Dict       =	num_channels
       lowerCAmelCase_:							int       =	kernel_size
       lowerCAmelCase_:							List[Any]       =	stride
       lowerCAmelCase_:							Union[str, Any]       =	padding
       lowerCAmelCase_:							Dict       =	hidden_sizes
       lowerCAmelCase_:							str       =	num_attention_heads
       lowerCAmelCase_:							Union[str, Any]       =	depths
       lowerCAmelCase_:							Optional[int]       =	key_dim
       lowerCAmelCase_:							int       =	drop_path_rate
       lowerCAmelCase_:							Optional[int]       =	patch_size
       lowerCAmelCase_:							Optional[int]       =	attention_ratio
       lowerCAmelCase_:							Any       =	mlp_ratio
       lowerCAmelCase_:							str       =	initializer_range
       lowerCAmelCase_:							Any       =	[
           ["Subsample", key_dim[0], hidden_sizes[0] // key_dim[0], 4, 2, 2],
           ["Subsample", key_dim[0], hidden_sizes[1] // key_dim[0], 4, 2, 2],
       ]





class 					_lowercase    (     UpperCAmelCase__			):






    '''simple docstring'''
    SCREAMING_SNAKE_CASE:				str          =    version.parse('1.11'			)




    @property
    def      _a    (    self ):
       return OrderedDict(
           [
               ("pixel_values", {0: "batch", 1: "num_channels", 2: "height", 3: "width"}),
           ] )




    @property
    def      _a    (    self ):
       return 1E-4
from typing import TYPE_CHECKING

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


a  :      List[str]            =    {
    """configuration_efficientformer""": [
        """EFFICIENTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP""",
        """EfficientFormerConfig""",
    ]
}

try:
 if not is_vision_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a  :      str            =    ["""EfficientFormerImageProcessor"""]

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a  :      List[str]            =    [
     """EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
     """EfficientFormerForImageClassification""",
     """EfficientFormerForImageClassificationWithTeacher""",
     """EfficientFormerModel""",
     """EfficientFormerPreTrainedModel""",
 ]

try:
 if not is_tf_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a  :      List[Any]            =    [
     """TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST""",
     """TFEfficientFormerForImageClassification""",
     """TFEfficientFormerForImageClassificationWithTeacher""",
     """TFEfficientFormerModel""",
     """TFEfficientFormerPreTrainedModel""",
 ]

if TYPE_CHECKING:
 from .configuration_efficientformer import EFFICIENTFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, EfficientFormerConfig

 try:
  if not is_vision_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .image_processing_efficientformer import EfficientFormerImageProcessor

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_efficientformer import (
      EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
      EfficientFormerForImageClassification,
      EfficientFormerForImageClassificationWithTeacher,
      EfficientFormerModel,
      EfficientFormerPreTrainedModel,
  )
 try:
  if not is_tf_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_tf_efficientformer import (
      TF_EFFICIENTFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
      TFEfficientFormerForImageClassification,
      TFEfficientFormerForImageClassificationWithTeacher,
      TFEfficientFormerModel,
      TFEfficientFormerPreTrainedModel,
  )

else:
 import sys

 a  :      Tuple            =    _LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)