




'''simple docstring'''



import functools
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

import huggingface_hub.utils as hf_hub_utils
from tqdm import auto as tqdm_lib


__A	=threading.Lock()
__A	=None

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

__A	=logging.WARNING

__A	=True







def     _UpperCamelCase      (		):
			UpperCAmelCase__  :					List[str]        =     os.getenv("""TRANSFORMERS_VERBOSITY""" ,      UpperCamelCase__					)
			if env_level_str:
						if env_level_str in log_levels:
									return log_levels[env_level_str]
						else:
									logging.getLogger().warning(
									    f'''Unknown option TRANSFORMERS_VERBOSITY={env_level_str}, '''
									    f'''has to be one of: { ', '.join(log_levels.keys()					) }'''					)
			return _default_log_level







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







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







def     _UpperCamelCase      (		):
			global _default_handler

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

						# Apply our default configuration to the library root logger.
						UpperCAmelCase__  :					Dict        =     _get_library_root_logger()
						library_root_logger.addHandler(_default_handler					)
						library_root_logger.setLevel(_get_default_logging_level()					)
						UpperCAmelCase__  :					List[str]        =     False







def     _UpperCamelCase      (		):
			global _default_handler

			with _lock:
						if not _default_handler:
									return

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







def     _UpperCamelCase      (		):
			return log_levels







def     _UpperCamelCase      (		UpperCamelCase__ = None					):

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

			_configure_library_root_logger()
			return logging.getLogger(UpperCamelCase__					)







def     _UpperCamelCase      (		):
			_configure_library_root_logger()
			return _get_library_root_logger().getEffectiveLevel()







def     _UpperCamelCase      (		UpperCamelCase__					):
			_configure_library_root_logger()
			_get_library_root_logger().setLevel(UpperCamelCase__					)







def     _UpperCamelCase      (		):
			return set_verbosity(UpperCamelCase__					)







def     _UpperCamelCase      (		):
			return set_verbosity(UpperCamelCase__					)







def     _UpperCamelCase      (		):
			return set_verbosity(UpperCamelCase__					)







def     _UpperCamelCase      (		):
			return set_verbosity(UpperCamelCase__					)







def     _UpperCamelCase      (		):
			_configure_library_root_logger()

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







def     _UpperCamelCase      (		):
			_configure_library_root_logger()

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







def     _UpperCamelCase      (		UpperCamelCase__					):
			_configure_library_root_logger()

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







def     _UpperCamelCase      (		UpperCamelCase__					):
			_configure_library_root_logger()

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







def     _UpperCamelCase      (		):
			_configure_library_root_logger()
			UpperCAmelCase__  :					Dict        =     False







def     _UpperCamelCase      (		):
			_configure_library_root_logger()
			UpperCAmelCase__  :					Any        =     True







def     _UpperCamelCase      (		):
			UpperCAmelCase__  :					str        =     _get_library_root_logger().handlers

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







def     _UpperCamelCase      (		):
			UpperCAmelCase__  :					Tuple        =     _get_library_root_logger().handlers

			for handler in handlers:
						handler.setFormatter(UpperCamelCase__					)







def     _UpperCamelCase      (		self ,      *UpperCamelCase__ ,      **UpperCamelCase__					):
			UpperCAmelCase__  :					Dict        =     os.getenv("""TRANSFORMERS_NO_ADVISORY_WARNINGS""" ,      UpperCamelCase__					)
			if no_advisory_warnings:
						return
			self.warning(*UpperCamelCase__ ,      **UpperCamelCase__					)


__A	=warning_advice







@functools.lru_cache(UpperCamelCase__					)
def     _UpperCamelCase      (		self ,      *UpperCamelCase__ ,      **UpperCamelCase__					):
			self.warning(*UpperCamelCase__ ,      **UpperCamelCase__					)


__A	=warning_once


class 		_snake_case					:




					def __init__(      self							,							*_lowerCamelCase							,							**_lowerCamelCase):  # pylint: disable=unused-argument
								UpperCAmelCase__  :					Union[str, Any]        =     args[0] if args else None




					def __iter__(      self):
								return iter(self._iterator)




					def __getattr__(      self							,							_lowerCamelCase):

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

								return empty_fn




					def __enter__(      self):
								return self




					def __exit__(      self							,							_lowerCamelCase							,							_lowerCamelCase							,							_lowerCamelCase):
								return


class 		_snake_case					:




					def __call__(      self							,							*_lowerCamelCase							,							**_lowerCamelCase):
								if _tqdm_active:
											return tqdm_lib.tqdm(*A__							,							**A__)
								else:
											return EmptyTqdm(*A__							,							**A__)




					def 				snake_case__						(      self							,							*_lowerCamelCase							,							**_lowerCamelCase):
								UpperCAmelCase__  :					Union[str, Any]        =     None
								if _tqdm_active:
											return tqdm_lib.tqdm.set_lock(*A__							,							**A__)




					def 				snake_case__						(      self):
								if _tqdm_active:
											return tqdm_lib.tqdm.get_lock()

__A	=_tqdm_cls()







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







def     _UpperCamelCase      (		):
			global _tqdm_active
			UpperCAmelCase__  :					Optional[Any]        =     True
			hf_hub_utils.enable_progress_bars()







def     _UpperCamelCase      (		):
			global _tqdm_active
			UpperCAmelCase__  :					List[str]        =     False
			hf_hub_utils.disable_progress_bars()



'''simple docstring'''



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tokenizers_available, is_torch_available


__A	={
    'configuration_nezha': ['NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP', 'NezhaConfig'],
}

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		__A	=[
		    'NEZHA_PRETRAINED_MODEL_ARCHIVE_LIST',
		    'NezhaForNextSentencePrediction',
		    'NezhaForMaskedLM',
		    'NezhaForPreTraining',
		    'NezhaForMultipleChoice',
		    'NezhaForQuestionAnswering',
		    'NezhaForSequenceClassification',
		    'NezhaForTokenClassification',
		    'NezhaModel',
		    'NezhaPreTrainedModel',
		]


if TYPE_CHECKING:
		from .configuration_nezha import NEZHA_PRETRAINED_CONFIG_ARCHIVE_MAP, NezhaConfig

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_nezha import (
				    NEZHA_PRETRAINED_MODEL_ARCHIVE_LIST,
				    NezhaForMaskedLM,
				    NezhaForMultipleChoice,
				    NezhaForNextSentencePrediction,
				    NezhaForPreTraining,
				    NezhaForQuestionAnswering,
				    NezhaForSequenceClassification,
				    NezhaForTokenClassification,
				    NezhaModel,
				    NezhaPreTrainedModel,
				)


else:
		import sys

		__A	=_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)