



'''simple docstring'''
import logging
import os
import sys
import threading
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


__SCREAMING_SNAKE_CASE :      Any             =threading.Lock()
__SCREAMING_SNAKE_CASE :      Optional[logging.Handler]             =None

__SCREAMING_SNAKE_CASE :      str             ={
    'debug': logging.DEBUG,
    'info': logging.INFO,
    'warning': logging.WARNING,
    'error': logging.ERROR,
    'critical': logging.CRITICAL,
}

__SCREAMING_SNAKE_CASE :      Tuple             =logging.WARNING

__SCREAMING_SNAKE_CASE :      List[Any]             =True



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			A:      str														=   os.getenv("""DIFFUSERS_VERBOSITY"""							,							lowerCamelCase__				)
			if env_level_str:
						if env_level_str in log_levels:
									return log_levels[env_level_str]
						else:
									logging.getLogger().warning(
									    f'Unknown option DIFFUSERS_VERBOSITY={env_level_str}, '
									    f'has to be one of: { ", ".join(log_levels.keys()				) }'				)
			return _default_log_level



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			return __name__.split("""."""				)[0]



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			return logging.getLogger(_get_library_name()				)



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			global _default_handler

			with _lock:
						if _default_handler:
									# This library has already configured the library root logger.
									return
						A:      Any														=   logging.StreamHandler()  # Set sys.stderr as stream.
						A:      List[str]														=   sys.stderr.flush

						# Apply our default configuration to the library root logger.
						A:      str														=   _get_library_root_logger()
						library_root_logger.addHandler(_default_handler				)
						library_root_logger.setLevel(_get_default_logging_level()				)
						A:      str														=   False



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			global _default_handler

			with _lock:
						if not _default_handler:
									return

						A:      List[Any]														=   _get_library_root_logger()
						library_root_logger.removeHandler(_default_handler				)
						library_root_logger.setLevel(logging.NOTSET				)
						A:      Optional[Any]														=   None



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			return log_levels



def 		_SCREAMING_SNAKE_CASE							(				lowerCamelCase__   :      Optional[str] = None				):


			'''simple docstring'''







			if name is None:
						A:      Union[str, Any]														=   _get_library_name()

			_configure_library_root_logger()
			return logging.getLogger(lowerCamelCase__				)



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			_configure_library_root_logger()
			return _get_library_root_logger().getEffectiveLevel()



def 		_SCREAMING_SNAKE_CASE							(				lowerCamelCase__   :      int				):


			'''simple docstring'''







			_configure_library_root_logger()
			_get_library_root_logger().setLevel(lowerCamelCase__				)



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			return set_verbosity(lowerCamelCase__				)



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			return set_verbosity(lowerCamelCase__				)



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			return set_verbosity(lowerCamelCase__				)



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			return set_verbosity(lowerCamelCase__				)



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			_configure_library_root_logger()

			assert _default_handler is not None
			_get_library_root_logger().removeHandler(_default_handler				)



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			_configure_library_root_logger()

			assert _default_handler is not None
			_get_library_root_logger().addHandler(_default_handler				)



def 		_SCREAMING_SNAKE_CASE							(				lowerCamelCase__   :      logging.Handler				):


			'''simple docstring'''







			_configure_library_root_logger()

			assert handler is not None
			_get_library_root_logger().addHandler(lowerCamelCase__				)



def 		_SCREAMING_SNAKE_CASE							(				lowerCamelCase__   :      logging.Handler				):


			'''simple docstring'''







			_configure_library_root_logger()

			assert handler is not None and handler not in _get_library_root_logger().handlers
			_get_library_root_logger().removeHandler(lowerCamelCase__				)



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			_configure_library_root_logger()
			A:      Tuple														=   False



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			_configure_library_root_logger()
			A:      Dict														=   True



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			A:      Optional[Any]														=   _get_library_root_logger().handlers

			for handler in handlers:
						A:      Optional[int]														=   logging.Formatter("""[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s"""				)
						handler.setFormatter(lowerCamelCase__				)



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			A:      Union[str, Any]														=   _get_library_root_logger().handlers

			for handler in handlers:
						handler.setFormatter(lowerCamelCase__				)



def 		_SCREAMING_SNAKE_CASE							(				self   :      str							,							*lowerCamelCase__   :      Tuple							,							**lowerCamelCase__   :      str				):


			'''simple docstring'''







			A:      Tuple														=   os.getenv("""DIFFUSERS_NO_ADVISORY_WARNINGS"""							,							lowerCamelCase__				)
			if no_advisory_warnings:
						return
			self.warning(*lowerCamelCase__							,							**lowerCamelCase__				)


__SCREAMING_SNAKE_CASE :      Tuple             =warning_advice


class   SCREAMING_SNAKE_CASE__				:
	"""simple docstring"""


	def __init__(		self					,   *A					,   **A			) ->							Any:  # pylint: disable=unused-argument
				A:      List[Any]														=   args[0] if args else None


	def __iter__(		self			) ->							Optional[Any]:
				return iter(self._iterator			)


	def __getattr__(		self					,   A			) ->							str:

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

				return empty_fn


	def __enter__(		self			) ->							str:
				return self





	def __exit__(		self					,   A					,   A					,   A			) ->							Union[str, Any]:
				return







class   SCREAMING_SNAKE_CASE__				:
	"""simple docstring"""


	def __call__(		self					,   *A					,   **A			) ->							Optional[Any]:
				if _tqdm_active:
							return tqdm_lib.tqdm(*A					,   **A			)
				else:
							return EmptyTqdm(*A					,   **A			)


	def      a__ (		self					,   *A					,   **A			) ->							str:
				A:      Optional[Any]														=   None
				if _tqdm_active:
							return tqdm_lib.tqdm.set_lock(*A					,   **A			)





	def      a__ (		self			) ->							List[str]:
				if _tqdm_active:
							return tqdm_lib.tqdm.get_lock()







__SCREAMING_SNAKE_CASE :      Union[str, Any]             =_tqdm_cls()



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			global _tqdm_active
			return bool(_tqdm_active				)



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			global _tqdm_active
			A:      int														=   True



def 		_SCREAMING_SNAKE_CASE							(				):


			'''simple docstring'''







			global _tqdm_active
			A:      Any														=   False










'''simple docstring'''
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
from ...utils.backbone_utils import BackboneConfigMixin, get_aligned_output_features_output_indices


__SCREAMING_SNAKE_CASE :      int             =logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE :      Optional[int]             ={
    'facebook/convnext-tiny-224': 'https://huggingface.co/facebook/convnext-tiny-224/resolve/main/config.json',
    # See all ConvNeXT models at https://huggingface.co/models?filter=convnext
}


class   SCREAMING_SNAKE_CASE__				(   snake_case_     ,			snake_case_					):
	"""simple docstring"""


	A__    :    List[str]						=				'''convnext'''


	def __init__(		self					,   A=3					,   A=4					,   A=4					,   A=None					,   A=None					,   A="gelu"					,   A=0.02					,   A=1e-12					,   A=1e-6					,   A=0.0					,   A=2_24					,   A=None					,   A=None					,   **A					,   ) ->							Dict:
				super().__init__(**A			)

				A:      List[str]														=   num_channels
				A:      Optional[Any]														=   patch_size
				A:      List[str]														=   num_stages
				A:      Tuple														=   [96, 1_92, 3_84, 7_68] if hidden_sizes is None else hidden_sizes
				A:      List[Any]														=   [3, 3, 9, 3] if depths is None else depths
				A:      int														=   hidden_act
				A:      int														=   initializer_range
				A:      Optional[int]														=   layer_norm_eps
				A:      Tuple														=   layer_scale_init_value
				A:      int														=   drop_path_rate
				A:      Tuple														=   image_size
				A:      Union[str, Any]														=   ["""stem"""] + [f'stage{idx}' for idx in range(1					,   len(self.depths			) + 1			)]
				A							,		A:      List[str]														=   get_aligned_output_features_output_indices(
				    out_features=A					,   out_indices=A					,   stage_names=self.stage_names			)







class   SCREAMING_SNAKE_CASE__				(   snake_case_					):
	"""simple docstring"""


	A__    :    Any						=				version.parse('''1.11'''					)


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





	@property
	def      a__ (		self			) ->							float:
				return 1e-5





