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


_lowerCAmelCase       =		logging.get_logger(__name__)

_lowerCAmelCase       =		{
    "microsoft/cvt-13": "https://huggingface.co/microsoft/cvt-13/resolve/main/config.json",
    # See all Cvt models at https://huggingface.co/models?filter=cvt
}
class     lowerCAmelCase_     (       __lowercase ):
							UpperCAmelCase				   =     "cvt"







							def __init__(   self      :     Optional[int] ,			_A      :     List[Any]=3 ,			_A      :     Any=[7, 3, 3] ,			_A      :     Optional[int]=[4, 2, 2] ,			_A      :     Union[str, Any]=[2, 1, 1] ,			_A      :     str=[64, 192, 384] ,			_A      :     Tuple=[1, 3, 6] ,			_A      :     Optional[Any]=[1, 2, 10] ,			_A      :     Optional[int]=[4.0, 4.0, 4.0] ,			_A      :     Optional[Any]=[0.0, 0.0, 0.0] ,			_A      :     Optional[int]=[0.0, 0.0, 0.0] ,			_A      :     int=[0.0, 0.0, 0.1] ,			_A      :     Tuple=[True, True, True] ,			_A      :     Any=[False, False, True] ,			_A      :     Union[str, Any]=["dw_bn", "dw_bn", "dw_bn"] ,			_A      :     Union[str, Any]=[3, 3, 3] ,			_A      :     List[str]=[1, 1, 1] ,			_A      :     str=[2, 2, 2] ,			_A      :     Union[str, Any]=[1, 1, 1] ,			_A      :     Dict=[1, 1, 1] ,			_A      :     List[str]=0.02 ,			_A      :     int=1e-12 ,			**_A      :     Any ,			):
												super().__init__(**_A		)
												_UpperCamelCase			     =     num_channels
												_UpperCamelCase			     =     patch_sizes
												_UpperCamelCase			     =     patch_stride
												_UpperCamelCase			     =     patch_padding
												_UpperCamelCase			     =     embed_dim
												_UpperCamelCase			     =     num_heads
												_UpperCamelCase			     =     depth
												_UpperCamelCase			     =     mlp_ratio
												_UpperCamelCase			     =     attention_drop_rate
												_UpperCamelCase			     =     drop_rate
												_UpperCamelCase			     =     drop_path_rate
												_UpperCamelCase			     =     qkv_bias
												_UpperCamelCase			     =     cls_token
												_UpperCamelCase			     =     qkv_projection_method
												_UpperCamelCase			     =     kernel_qkv
												_UpperCamelCase			     =     padding_kv
												_UpperCamelCase			     =     stride_kv
												_UpperCamelCase			     =     padding_q
												_UpperCamelCase			     =     stride_q
												_UpperCamelCase			     =     initializer_range
												_UpperCamelCase			     =     layer_norm_eps

import logging
import os

from .state import PartialState
class     lowerCAmelCase_     (       logging.LoggerAdapter ):







							@staticmethod
							def  UpperCamelCase_						(   _A      :     Any		):
												_UpperCamelCase			     =     PartialState()
												return not main_process_only or (main_process_only and state.is_main_process)







							def  UpperCamelCase_						(   self      :     Union[str, Any] ,			_A      :     Optional[Any] ,			_A      :     str ,			*_A      :     int ,			**_A      :     List[Any]		):
												if PartialState._shared_state == {}:
																	raise RuntimeError(
																	    '''You must initialize the accelerate state by calling either `PartialState()` or `Accelerator()` before using the logging utility.'''		)
												_UpperCamelCase			     =     kwargs.pop('''main_process_only''' ,			_A		)
												_UpperCamelCase			     =     kwargs.pop('''in_order''' ,			_A		)

												if self.isEnabledFor(_A		):
																	if self._should_log(_A		):
																						_UpperCamelCase     ,    _UpperCamelCase			     =     self.process(_A ,			_A		)
																						self.logger.log(_A ,			_A ,			*_A ,			**_A		)

																	elif in_order:
																						_UpperCamelCase			     =     PartialState()
																						for i in range(state.num_processes		):
																											if i == state.process_index:
																																_UpperCamelCase     ,    _UpperCamelCase			     =     self.process(_A ,			_A		)
																																self.logger.log(_A ,			_A ,			*_A ,			**_A		)
																											state.wait_for_everyone()




def 					_snake_case	(  __snake_case  ,     __snake_case = None						):
					if log_level is None:
										_UpperCamelCase			     =     os.environ.get('''ACCELERATE_LOG_LEVEL'''  ,     __snake_case						)
					_UpperCamelCase			     =     logging.getLogger(__snake_case						)
					if log_level is not None:
										logger.setLevel(log_level.upper()						)
										logger.root.setLevel(log_level.upper()						)
					return MultiProcessAdapter(__snake_case  ,     {}						)
