





"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


_snake_case     :		int       						= logging.get_logger(__name__)

_snake_case     :		Optional[Any]       						= {
    'shi-labs/nat-mini-in1k-224': 'https://huggingface.co/shi-labs/nat-mini-in1k-224/resolve/main/config.json',
    # See all Nat models at https://huggingface.co/models?filter=nat
}






class 					_UpperCAmelCase   (	a__     ,							a__ ):
					UpperCamelCase      =							'''nat'''

					UpperCamelCase      =							{
					    '''num_attention_heads''': '''num_heads''',
					    '''num_hidden_layers''': '''num_layers''',
					}


					def __init__(					self			:int     ,       __UpperCamelCase			:List[str]=4     ,       __UpperCamelCase			:Optional[int]=3     ,       __UpperCamelCase			:Dict=64     ,       __UpperCamelCase			:List[str]=[3, 4, 6, 5]     ,       __UpperCamelCase			:Optional[Any]=[2, 4, 8, 16]     ,       __UpperCamelCase			:int=7     ,       __UpperCamelCase			:Union[str, Any]=3.0     ,       __UpperCamelCase			:List[str]=True     ,       __UpperCamelCase			:Optional[int]=0.0     ,       __UpperCamelCase			:Optional[Any]=0.0     ,       __UpperCamelCase			:Optional[int]=0.1     ,       __UpperCamelCase			:Tuple="gelu"     ,       __UpperCamelCase			:str=0.02     ,       __UpperCamelCase			:Optional[int]=1e-5     ,       __UpperCamelCase			:List[Any]=0.0     ,       __UpperCamelCase			:int=None     ,       __UpperCamelCase			:Union[str, Any]=None     ,       **__UpperCamelCase			:Optional[int]     ,       ):
												super().__init__(**SCREAMING_SNAKE_CASE__		)

												A		=  patch_size
												A		=  num_channels
												A		=  embed_dim
												A		=  depths
												A		=  len(SCREAMING_SNAKE_CASE__		)
												A		=  num_heads
												A		=  kernel_size
												A		=  mlp_ratio
												A		=  qkv_bias
												A		=  hidden_dropout_prob
												A		=  attention_probs_dropout_prob
												A		=  drop_path_rate
												A		=  hidden_act
												A		=  layer_norm_eps
												A		=  initializer_range
												# we set the hidden_size attribute in order to make Nat work with VisionEncoderDecoderModel
												# this indicates the channel dimension after the last stage of the model
												A		=  int(embed_dim * 2 ** (len(SCREAMING_SNAKE_CASE__		) - 1)		)
												A		=  layer_scale_init_value
												A		=  ["""stem"""] + [f"stage{idx}" for idx in range(1     ,       len(SCREAMING_SNAKE_CASE__		) + 1		)]
												A		=  get_aligned_output_features_output_indices(
												    out_features=SCREAMING_SNAKE_CASE__     ,       out_indices=SCREAMING_SNAKE_CASE__     ,       stage_names=self.stage_names		)




"""simple docstring"""




import logging
import os
from logging import (
    CRITICAL,  # NOQA
    DEBUG,  # NOQA
    ERROR,  # NOQA
    FATAL,  # NOQA
    INFO,  # NOQA
    NOTSET,  # NOQA
    WARN,  # NOQA
    WARNING,  # NOQA
)
from typing import Optional

from tqdm import auto as tqdm_lib


UpperCAmelCase__      :    Optional[int]    							= {
    'debug': logging.DEBUG,
    'info': logging.INFO,
    'warning': logging.WARNING,
    'error': logging.ERROR,
    'critical': logging.CRITICAL,
}

UpperCAmelCase__      :    List[Any]    							= logging.WARNING

def lowercase_  (   ):
							SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   os.getenv("""DATASETS_VERBOSITY"""   ,_snake_case						)
							if env_level_str:
														if env_level_str in log_levels:
																					return log_levels[env_level_str]
														else:
																					logging.getLogger().warning(
																					    f'''Unknown option DATASETS_VERBOSITY={env_level_str}, '''
																					    f'''has to be one of: { ', '.join(log_levels.keys()						) }'''						)
							return _default_log_level

def lowercase_  (   ):
							return __name__.split("""."""						)[0]

def lowercase_  (   ):
							return logging.getLogger(_get_library_name()						)

def lowercase_  (   ):
							# Apply our default configuration to the library root logger.
							SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   _get_library_root_logger()
							library_root_logger.setLevel(_get_default_logging_level()						)

def lowercase_  (   ):
							SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   _get_library_root_logger()
							library_root_logger.setLevel(logging.NOTSET						)

def lowercase_  (   _snake_case = None						):
							if name is None:
														SCREAMING_SNAKE_CASE__						:       Optional[Any]           =   _get_library_name()
							return logging.getLogger(_snake_case						)

def lowercase_  (   ):
							return _get_library_root_logger().getEffectiveLevel()

def lowercase_  (   _snake_case						):
							_get_library_root_logger().setLevel(_snake_case						)

def lowercase_  (   ):
							return set_verbosity(_snake_case						)

def lowercase_  (   ):
							return set_verbosity(_snake_case						)

def lowercase_  (   ):
							return set_verbosity(_snake_case						)

def lowercase_  (   ):
							return set_verbosity(_snake_case						)

def lowercase_  (   ):
							SCREAMING_SNAKE_CASE__						:       Tuple           =   False

def lowercase_  (   ):
							SCREAMING_SNAKE_CASE__						:       str           =   True


# Configure the library root logger at the module level (singleton-like)
_configure_library_root_logger()



class 	lowerCAmelCase_						:


				"""simple docstring"""



				def __init__(self   ,       *SCREAMING_SNAKE_CASE__   ,       **SCREAMING_SNAKE_CASE__    )					->		int:  # pylint: disable=unused-argument



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__						:       List[str]           =   args[0] if args else None



				def __iter__(self    )					->		int:



											"""simple docstring"""




											return iter(self._iterator    )



				def __getattr__(self   ,       SCREAMING_SNAKE_CASE__    )					->		int:



											"""simple docstring"""




											def empty_fn(*SCREAMING_SNAKE_CASE__   ,       **SCREAMING_SNAKE_CASE__    ):  # pylint: disable=unused-argument
																		return

											return empty_fn



				def __enter__(self    )					->		Dict:



											"""simple docstring"""




											return self



				def __exit__(self   ,       SCREAMING_SNAKE_CASE__   ,       SCREAMING_SNAKE_CASE__   ,       SCREAMING_SNAKE_CASE__    )					->		str:



											"""simple docstring"""




											return






UpperCAmelCase__      :    str    							= True



class 	lowerCAmelCase_						:


				"""simple docstring"""



				def __call__(self   ,       *SCREAMING_SNAKE_CASE__   ,       SCREAMING_SNAKE_CASE__=False   ,       **SCREAMING_SNAKE_CASE__    )					->		List[Any]:



											"""simple docstring"""




											if _tqdm_active and not disable:
																		return tqdm_lib.tqdm(*SCREAMING_SNAKE_CASE__   ,       **SCREAMING_SNAKE_CASE__    )
											else:
																		return EmptyTqdm(*SCREAMING_SNAKE_CASE__   ,       **SCREAMING_SNAKE_CASE__    )



				def 	__magic_name__    (self   ,       *SCREAMING_SNAKE_CASE__   ,       **SCREAMING_SNAKE_CASE__    )					->		int:



											"""simple docstring"""




											SCREAMING_SNAKE_CASE__						:       List[Any]           =   None
											if _tqdm_active:
																		return tqdm_lib.tqdm.set_lock(*SCREAMING_SNAKE_CASE__   ,       **SCREAMING_SNAKE_CASE__    )



				def 	__magic_name__    (self    )					->		Optional[Any]:



											"""simple docstring"""




											if _tqdm_active:
																		return tqdm_lib.tqdm.get_lock()






UpperCAmelCase__      :    Tuple    							= _tqdm_cls()

def lowercase_  (   ):
							global _tqdm_active
							return bool(_tqdm_active						)

def lowercase_  (   ):
							global _tqdm_active
							SCREAMING_SNAKE_CASE__						:       Union[str, Any]           =   True

def lowercase_  (   ):
							global _tqdm_active
							SCREAMING_SNAKE_CASE__						:       str           =   False




