


import importlib.metadata
import operator
import re
import sys
from typing import Optional

from packaging import version


__lowerCAmelCase	: Union[str, Any]  				={
    '<': operator.lt,
    '<=': operator.le,
    '==': operator.eq,
    '!=': operator.ne,
    '>=': operator.ge,
    '>': operator.gt,
}


def        _UpperCamelCase							(      lowercase__    ,       lowercase__    ,       lowercase__    ,       lowercase__    ,       lowercase__    ,       lowercase__      ):
						if got_ver is None or want_ver is None:
												raise ValueError(
												    F'''Unable to compare versions for {requirement}: need={want_ver} found={got_ver}. This is unusual. Consider'''
												    F''' reinstalling {pkg}.'''      )
						if not ops[op](version.parse(lowercase__      )    ,       version.parse(lowercase__      )      ):
												raise ImportError(
												    F'''{requirement} is required for a normal functioning of this module, but found {pkg}=={got_ver}.{hint}'''      )


def        _UpperCamelCase							(      lowercase__    ,       lowercase__ = None      ):
						__SCREAMING_SNAKE_CASE						:     Union[str, Any]					=		F'''\n{hint}''' if hint is not None else ''''''

						# non-versioned check
						if re.match(R'''^[\w_\-\d]+$'''    ,       lowercase__      ):
												__SCREAMING_SNAKE_CASE			,			__SCREAMING_SNAKE_CASE			,			__SCREAMING_SNAKE_CASE						:     str					=		requirement, None, None
						else:
												__SCREAMING_SNAKE_CASE						:     List[Any]					=		re.findall(R'''^([^!=<>\s]+)([\s!=<>]{1,2}.+)'''    ,       lowercase__      )
												if not match:
																		raise ValueError(
																		    '''requirement needs to be in the pip package format, .e.g., package_a==1.23, or package_b>=1.23, but'''
																		    F''' got {requirement}'''      )
												__SCREAMING_SNAKE_CASE			,			__SCREAMING_SNAKE_CASE						:     Tuple					=		match[0]
												__SCREAMING_SNAKE_CASE						:     Optional[int]					=		want_full.split(''','''      )  # there could be multiple requirements
												__SCREAMING_SNAKE_CASE						:     Optional[Any]					=		{}
												for w in want_range:
																		__SCREAMING_SNAKE_CASE						:     Any					=		re.findall(R'''^([\s!=<>]{1,2})(.+)'''    ,       lowercase__      )
																		if not match:
																								raise ValueError(
																								    '''requirement needs to be in the pip package format, .e.g., package_a==1.23, or package_b>=1.23,'''
																								    F''' but got {requirement}'''      )
																		__SCREAMING_SNAKE_CASE			,			__SCREAMING_SNAKE_CASE						:     Tuple					=		match[0]
																		__SCREAMING_SNAKE_CASE						:     List[Any]					=		want_ver
																		if op not in ops:
																								raise ValueError(F'''{requirement}: need one of {list(ops.keys()      )}, but got {op}'''      )

    # special case
						if pkg == "python":
												__SCREAMING_SNAKE_CASE						:     Optional[Any]					=		'''.'''.join([str(lowercase__      ) for x in sys.version_info[:3]]      )
												for op, want_ver in wanted.items():
																		_compare_versions(lowercase__    ,       lowercase__    ,       lowercase__    ,       lowercase__    ,       lowercase__    ,       lowercase__      )
												return

						# check if any version is installed
						try:
												__SCREAMING_SNAKE_CASE						:     Optional[int]					=		importlib.metadata.version(lowercase__      )
						except importlib.metadata.PackageNotFoundError:
												raise importlib.metadata.PackageNotFoundError(
												    F'''The \'{requirement}\' distribution was not found and is required by this application. {hint}'''      )

						# check that the right version is installed if version number or a range was provided
						if want_ver is not None:
												for op, want_ver in wanted.items():
																		_compare_versions(lowercase__    ,       lowercase__    ,       lowercase__    ,       lowercase__    ,       lowercase__    ,       lowercase__      )


def        _UpperCamelCase							(      lowercase__      ):
						__SCREAMING_SNAKE_CASE						:     Union[str, Any]					=		'''Try: pip install transformers -U or pip install -e \'.[dev]\' if you\'re working with git main'''
						return require_version(lowercase__    ,       lowercase__      )

"""simple docstring"""






from typing import List

from ...configuration_utils import PretrainedConfig
from ...utils import logging


__A			   = logging.get_logger(__name__)

__A			   = {
    "snap-research/efficientformer-l1-300": (
        "https://huggingface.co/snap-research/efficientformer-l1-300/resolve/main/config.json"
    ),
}


class     UpperCAmelCase						(_UpperCAmelCase  ):



    """simple docstring"""

    _UpperCAmelCase	:Optional[Any]						    = "efficientformer"






    def __init__(   self    ,			_UpperCAmelCase = [3, 2, 6, 4]    ,			_UpperCAmelCase = [48, 96, 224, 448]    ,			_UpperCAmelCase = [True, True, True, True]    ,			_UpperCAmelCase = 448    ,			_UpperCAmelCase = 32    ,			_UpperCAmelCase = 4    ,			_UpperCAmelCase = 7    ,			_UpperCAmelCase = 5    ,			_UpperCAmelCase = 8    ,			_UpperCAmelCase = 4    ,			_UpperCAmelCase = 0.0    ,			_UpperCAmelCase = 16    ,			_UpperCAmelCase = 3    ,			_UpperCAmelCase = 3    ,			_UpperCAmelCase = 3    ,			_UpperCAmelCase = 2    ,			_UpperCAmelCase = 1    ,			_UpperCAmelCase = 0.0    ,			_UpperCAmelCase = 1    ,			_UpperCAmelCase = True    ,			_UpperCAmelCase = True    ,			_UpperCAmelCase = 1e-5    ,			_UpperCAmelCase = "gelu"    ,			_UpperCAmelCase = 0.02    ,			_UpperCAmelCase = 1e-1_2    ,			_UpperCAmelCase = 224    ,			_UpperCAmelCase = 1e-0_5    ,			**_UpperCAmelCase    ,			):
       super().__init__(**_UpperCAmelCase							)

       lowercase__:   List[str]					=      hidden_act
       lowercase__:   Union[str, Any]					=      hidden_dropout_prob
       lowercase__:   Union[str, Any]					=      hidden_sizes
       lowercase__:   Any					=      num_hidden_layers
       lowercase__:   int					=      num_attention_heads
       lowercase__:   Dict					=      initializer_range
       lowercase__:   Optional[int]					=      layer_norm_eps
       lowercase__:   int					=      patch_size
       lowercase__:   int					=      num_channels
       lowercase__:   str					=      depths
       lowercase__:   List[str]					=      mlp_expansion_ratio
       lowercase__:   List[str]					=      downsamples
       lowercase__:   List[str]					=      dim
       lowercase__:   Optional[Any]					=      key_dim
       lowercase__:   Union[str, Any]					=      attention_ratio
       lowercase__:   Any					=      resolution
       lowercase__:   Any					=      pool_size
       lowercase__:   List[Any]					=      downsample_patch_size
       lowercase__:   Optional[int]					=      downsample_stride
       lowercase__:   Union[str, Any]					=      downsample_pad
       lowercase__:   List[Any]					=      drop_path_rate
       lowercase__:   Optional[Any]					=      num_metaad_blocks
       lowercase__:   Any					=      distillation
       lowercase__:   Optional[int]					=      use_layer_scale
       lowercase__:   List[str]					=      layer_scale_init_value
       lowercase__:   Dict					=      image_size
       lowercase__:   List[str]					=      batch_norm_eps
