






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


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       a__						(  ):
   lowercase__						:	Optional[int]         = os.getenv("""DIFFUSERS_VERBOSITY"""		,				A					)
   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       a__						(  ):
   return __name__.split("""."""					)[0]
def       a__						(  ):
   return logging.getLogger(_get_library_name()					)
def       a__						(  ):
   global _default_handler

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

      # Apply our default configuration to the library root logger.
      lowercase__						:	int         = _get_library_root_logger()
      library_root_logger.addHandler(_default_handler					)
      library_root_logger.setLevel(_get_default_logging_level()					)
      lowercase__						:	Optional[int]         = False
def       a__						(  ):
   global _default_handler

   with _lock:
      if not _default_handler:
         return

      lowercase__						:	Tuple         = _get_library_root_logger()
      library_root_logger.removeHandler(_default_handler					)
      library_root_logger.setLevel(logging.NOTSET					)
      lowercase__						:	Union[str, Any]         = None
def       a__						(  ):
   return log_levels
def       a__						(  A = None					):

   if name is None:
      lowercase__						:	List[Any]         = _get_library_name()

   _configure_library_root_logger()
   return logging.getLogger(A					)
def       a__						(  ):
   _configure_library_root_logger()
   return _get_library_root_logger().getEffectiveLevel()
def       a__						(  A					):
   _configure_library_root_logger()
   _get_library_root_logger().setLevel(A					)
def       a__						(  ):
   return set_verbosity(A					)
def       a__						(  ):
   return set_verbosity(A					)
def       a__						(  ):
   return set_verbosity(A					)
def       a__						(  ):
   return set_verbosity(A					)
def       a__						(  ):
   _configure_library_root_logger()

   assert _default_handler is not None
   _get_library_root_logger().removeHandler(_default_handler					)
def       a__						(  ):
   _configure_library_root_logger()

   assert _default_handler is not None
   _get_library_root_logger().addHandler(_default_handler					)
def       a__						(  A					):
   _configure_library_root_logger()

   assert handler is not None
   _get_library_root_logger().addHandler(A					)
def       a__						(  A					):
   _configure_library_root_logger()

   assert handler is not None and handler not in _get_library_root_logger().handlers
   _get_library_root_logger().removeHandler(A					)
def       a__						(  ):
   _configure_library_root_logger()
   lowercase__						:	Tuple         = False
def       a__						(  ):
   _configure_library_root_logger()
   lowercase__						:	Any         = True
def       a__						(  ):
   lowercase__						:	Union[str, Any]         = _get_library_root_logger().handlers

   for handler in handlers:
      lowercase__						:	Dict         = logging.Formatter("""[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s"""					)
      handler.setFormatter(A					)
def       a__						(  ):
   lowercase__						:	Optional[Any]         = _get_library_root_logger().handlers

   for handler in handlers:
      handler.setFormatter(A					)
def       a__						(  self		,				*A		,				**A					):
   lowercase__						:	List[str]         = os.getenv("""DIFFUSERS_NO_ADVISORY_WARNINGS"""		,				A					)
   if no_advisory_warnings:
      return
   self.warning(*A		,				**A					)


a    =       warning_advice
class        __snake_case:



 def __init__(	self   :   Optional[int] ,		*UpperCAmelCase__   :   Any ,		**UpperCAmelCase__   :   List[str]	):  # pylint: disable=unused-argument

    """simple docstring"""






    lowercase__						:	Tuple         = args[0] if args else None



 def __iter__(	self   :   Union[str, Any]	):

    """simple docstring"""






    return iter(self._iterator	)



 def __getattr__(	self   :   str ,		UpperCAmelCase__   :   str	):

    """simple docstring"""






    def empty_fn(*UpperCAmelCase__   :   List[str] ,		**UpperCAmelCase__   :   List[Any]	):  # pylint: disable=unused-argument
       return

    return empty_fn



 def __enter__(	self   :   Any	):

    """simple docstring"""






    return self







 def __exit__(	self   :   str ,		UpperCAmelCase__   :   Dict ,		UpperCAmelCase__   :   Dict ,		UpperCAmelCase__   :   Optional[int]	):

    """simple docstring"""






    return
class        __snake_case:



 def __call__(	self   :   str ,		*UpperCAmelCase__   :   List[str] ,		**UpperCAmelCase__   :   Optional[int]	):

    """simple docstring"""






    if _tqdm_active:
       return tqdm_lib.tqdm(*UpperCAmelCase__ ,		**UpperCAmelCase__	)
    else:
       return EmptyTqdm(*UpperCAmelCase__ ,		**UpperCAmelCase__	)



 def 						UpperCAmelCase    (	self   :   str ,		*UpperCAmelCase__   :   int ,		**UpperCAmelCase__   :   Optional[int]	):

    """simple docstring"""






    lowercase__						:	Optional[int]         = None
    if _tqdm_active:
       return tqdm_lib.tqdm.set_lock(*UpperCAmelCase__ ,		**UpperCAmelCase__	)







 def 						UpperCAmelCase    (	self   :   int	):

    """simple docstring"""






    if _tqdm_active:
       return tqdm_lib.tqdm.get_lock()
a    =       _tqdm_cls()
def       a__						(  ):
   global _tqdm_active
   return bool(_tqdm_active					)
def       a__						(  ):
   global _tqdm_active
   lowercase__						:	Any         = True






def       a__						(  ):
   global _tqdm_active
   lowercase__						:	List[str]         = False










from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


a    =       logging.get_logger(__name__)

a    =       {
    'nghuyong/ernie-1.0-base-zh': 'https://huggingface.co/nghuyong/ernie-1.0-base-zh/resolve/main/config.json',
    'nghuyong/ernie-2.0-base-en': 'https://huggingface.co/nghuyong/ernie-2.0-base-en/resolve/main/config.json',
    'nghuyong/ernie-2.0-large-en': 'https://huggingface.co/nghuyong/ernie-2.0-large-en/resolve/main/config.json',
    'nghuyong/ernie-3.0-base-zh': 'https://huggingface.co/nghuyong/ernie-3.0-base-zh/resolve/main/config.json',
    'nghuyong/ernie-3.0-medium-zh': 'https://huggingface.co/nghuyong/ernie-3.0-medium-zh/resolve/main/config.json',
    'nghuyong/ernie-3.0-mini-zh': 'https://huggingface.co/nghuyong/ernie-3.0-mini-zh/resolve/main/config.json',
    'nghuyong/ernie-3.0-micro-zh': 'https://huggingface.co/nghuyong/ernie-3.0-micro-zh/resolve/main/config.json',
    'nghuyong/ernie-3.0-nano-zh': 'https://huggingface.co/nghuyong/ernie-3.0-nano-zh/resolve/main/config.json',
    'nghuyong/ernie-gram-zh': 'https://huggingface.co/nghuyong/ernie-gram-zh/resolve/main/config.json',
    'nghuyong/ernie-health-zh': 'https://huggingface.co/nghuyong/ernie-health-zh/resolve/main/config.json',
}
class        __snake_case(					__UpperCamelCase      ):
 lowercase :       Dict		      =		'''ernie'''



 def __init__(	self   :   Tuple ,		UpperCAmelCase__   :   int=30_522 ,		UpperCAmelCase__   :   List[str]=768 ,		UpperCAmelCase__   :   Tuple=12 ,		UpperCAmelCase__   :   Optional[int]=12 ,		UpperCAmelCase__   :   Any=3_072 ,		UpperCAmelCase__   :   Tuple="gelu" ,		UpperCAmelCase__   :   Union[str, Any]=0.1 ,		UpperCAmelCase__   :   str=0.1 ,		UpperCAmelCase__   :   List[str]=512 ,		UpperCAmelCase__   :   str=2 ,		UpperCAmelCase__   :   Optional[int]=3 ,		UpperCAmelCase__   :   Dict=False ,		UpperCAmelCase__   :   Any=0.02 ,		UpperCAmelCase__   :   Any=1e-12 ,		UpperCAmelCase__   :   str=0 ,		UpperCAmelCase__   :   Any="absolute" ,		UpperCAmelCase__   :   List[str]=True ,		UpperCAmelCase__   :   Tuple=None ,		**UpperCAmelCase__   :   Dict ,		):

    """simple docstring"""






    super().__init__(pad_token_id=UpperCAmelCase__ ,		**UpperCAmelCase__	)

    lowercase__						:	List[str]         = vocab_size
    lowercase__						:	Optional[int]         = hidden_size
    lowercase__						:	Union[str, Any]         = num_hidden_layers
    lowercase__						:	Any         = num_attention_heads
    lowercase__						:	Optional[int]         = hidden_act
    lowercase__						:	str         = intermediate_size
    lowercase__						:	Tuple         = hidden_dropout_prob
    lowercase__						:	Tuple         = attention_probs_dropout_prob
    lowercase__						:	str         = max_position_embeddings
    lowercase__						:	List[Any]         = type_vocab_size
    lowercase__						:	Any         = task_type_vocab_size
    lowercase__						:	Optional[Any]         = use_task_id
    lowercase__						:	Optional[Any]         = initializer_range
    lowercase__						:	Union[str, Any]         = layer_norm_eps
    lowercase__						:	Dict         = position_embedding_type
    lowercase__						:	Union[str, Any]         = use_cache
    lowercase__						:	int         = classifier_dropout
class        __snake_case(					__UpperCamelCase      ):



 @property
 def 						UpperCAmelCase    (	self   :   List[Any]	):

    """simple docstring"""






    if self.task == "multiple-choice":
       lowercase__						:	Dict         = {0: """batch""", 1: """choice""", 2: """sequence"""}
    else:
       lowercase__						:	Dict         = {0: """batch""", 1: """sequence"""}
    return OrderedDict(
        [
            ("""input_ids""", dynamic_axis),
            ("""attention_mask""", dynamic_axis),
            ("""token_type_ids""", dynamic_axis),
            ("""task_type_ids""", dynamic_axis),
        ]	)


