

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


lowerCAmelCase     :   int						     =  threading.Lock()
lowerCAmelCase     :   Optional[logging.Handler]						     =  None

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

lowerCAmelCase     :   Any						     =  logging.WARNING

lowerCAmelCase     :   Dict						     =  True

def    A_  (							):

      """simple docstring"""



      SCREAMING_SNAKE_CASE_				:  Union[str, Any]           =     os.getenv('TRANSFORMERS_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 TRANSFORMERS_VERBOSITY={env_level_str}, "
                      f"has to be one of: { ', '.join(log_levels.keys()  ) }"  )
      return _default_log_level

def    A_  (							):

      """simple docstring"""



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

def    A_  (							):

      """simple docstring"""



      return logging.getLogger(_get_library_name()  )

def    A_  (							):

      """simple docstring"""



      global _default_handler

      with _lock:
            if _default_handler:
                  # This library has already configured the library root logger.
                  return
            SCREAMING_SNAKE_CASE_				:  int           =     logging.StreamHandler()  # Set sys.stderr as stream.
            SCREAMING_SNAKE_CASE_				:  int           =     sys.stderr.flush

            # Apply our default configuration to the library root logger.
            SCREAMING_SNAKE_CASE_				:  Union[str, Any]           =     _get_library_root_logger()
            library_root_logger.addHandler(_default_handler  )
            library_root_logger.setLevel(_get_default_logging_level()  )
            SCREAMING_SNAKE_CASE_				:  Tuple           =     False

def    A_  (							):

      """simple docstring"""



      global _default_handler

      with _lock:
            if not _default_handler:
                  return

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

def    A_  (							):

      """simple docstring"""



      return log_levels

def    A_  (							a = None  ):

      """simple docstring"""



      if name is None:
            SCREAMING_SNAKE_CASE_				:  Any           =     _get_library_name()

      _configure_library_root_logger()
      return logging.getLogger(a  )

def    A_  (							):

      """simple docstring"""



      _configure_library_root_logger()
      return _get_library_root_logger().getEffectiveLevel()

def    A_  (							a  ):

      """simple docstring"""



      _configure_library_root_logger()
      _get_library_root_logger().setLevel(a  )

def    A_  (							):

      """simple docstring"""



      return set_verbosity(a  )

def    A_  (							):

      """simple docstring"""



      return set_verbosity(a  )

def    A_  (							):

      """simple docstring"""



      return set_verbosity(a  )

def    A_  (							):

      """simple docstring"""



      return set_verbosity(a  )

def    A_  (							):

      """simple docstring"""



      _configure_library_root_logger()

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

def    A_  (							):

      """simple docstring"""



      _configure_library_root_logger()

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

def    A_  (							a  ):

      """simple docstring"""



      _configure_library_root_logger()

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

def    A_  (							a  ):

      """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(a  )

def    A_  (							):

      """simple docstring"""



      _configure_library_root_logger()
      SCREAMING_SNAKE_CASE_				:  Any           =     False

def    A_  (							):

      """simple docstring"""



      _configure_library_root_logger()
      SCREAMING_SNAKE_CASE_				:  int           =     True

def    A_  (							):

      """simple docstring"""



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

      for handler in handlers:
            SCREAMING_SNAKE_CASE_				:  Union[str, Any]           =     logging.Formatter('[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s'  )
            handler.setFormatter(a  )

def    A_  (							):

      """simple docstring"""



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

      for handler in handlers:
            handler.setFormatter(a  )

def    A_  (							self					,   *a					,   **a  ):

      """simple docstring"""



      SCREAMING_SNAKE_CASE_				:  Union[str, Any]           =     os.getenv('TRANSFORMERS_NO_ADVISORY_WARNINGS'					,   a  )
      if no_advisory_warnings:
            return
      self.warning(*a					,   **a  )


lowerCAmelCase     :   Union[str, Any]						     =  warning_advice

@functools.lru_cache(a  )
def    A_  (							self					,   *a					,   **a  ):

      """simple docstring"""



      self.warning(*a					,   **a  )


lowerCAmelCase     :   Optional[Any]						     =  warning_once
class  _A		:

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):  # pylint: disable=unused-argument





        """simple docstring"""







        SCREAMING_SNAKE_CASE_				:  Union[str, Any]           =     args[0] if args else None

  def __iter__(				self					):





        """simple docstring"""







        return iter(self._iterator					)

  def __getattr__(				self ,					_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







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

        return empty_fn

  def __enter__(				self					):





        """simple docstring"""







        return self



  def __exit__(				self ,					_SCREAMING_SNAKE_CASE ,					_SCREAMING_SNAKE_CASE ,					_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        return

class  _A		:

  def __call__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







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

  def  UpperCAmelCase    (				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        SCREAMING_SNAKE_CASE_				:  Tuple           =     None
        if _tqdm_active:
              return tqdm_lib.tqdm.set_lock(*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					)



  def  UpperCAmelCase    (				self					):





        """simple docstring"""







        if _tqdm_active:
              return tqdm_lib.tqdm.get_lock()

lowerCAmelCase     :   Optional[Any]						     =  _tqdm_cls()

def    A_  (							):

      """simple docstring"""



      global _tqdm_active
      return bool(_tqdm_active  )

def    A_  (							):

      """simple docstring"""



      global _tqdm_active
      SCREAMING_SNAKE_CASE_				:  Union[str, Any]           =     True
      hf_hub_utils.enable_progress_bars()



def    A_  (							):

      """simple docstring"""



      global _tqdm_active
      SCREAMING_SNAKE_CASE_				:  str           =     False
      hf_hub_utils.disable_progress_bars()









from ..utils import DummyObject, requires_backends
class  _A		(  metaclass=__magic_name__):
  SCREAMING_SNAKE_CASE    :      Optional[int]       =  ['''flax''']

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(self ,					['flax']					)

  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)



  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)

class  _A		(  metaclass=__magic_name__):
  SCREAMING_SNAKE_CASE    :      List[str]       =  ['''flax''']

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(self ,					['flax']					)

  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)



  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)

class  _A		(  metaclass=__magic_name__):
  SCREAMING_SNAKE_CASE    :      Any       =  ['''flax''']

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(self ,					['flax']					)

  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)



  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)

class  _A		(  metaclass=__magic_name__):
  SCREAMING_SNAKE_CASE    :      Optional[Any]       =  ['''flax''']

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(self ,					['flax']					)

  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)



  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)

class  _A		(  metaclass=__magic_name__):
  SCREAMING_SNAKE_CASE    :      int       =  ['''flax''']

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(self ,					['flax']					)

  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)



  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)

class  _A		(  metaclass=__magic_name__):
  SCREAMING_SNAKE_CASE    :      List[str]       =  ['''flax''']

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(self ,					['flax']					)

  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)



  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)

class  _A		(  metaclass=__magic_name__):
  SCREAMING_SNAKE_CASE    :      int       =  ['''flax''']

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(self ,					['flax']					)

  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)



  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)

class  _A		(  metaclass=__magic_name__):
  SCREAMING_SNAKE_CASE    :      Any       =  ['''flax''']

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(self ,					['flax']					)

  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)



  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)

class  _A		(  metaclass=__magic_name__):
  SCREAMING_SNAKE_CASE    :      Optional[Any]       =  ['''flax''']

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(self ,					['flax']					)

  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)



  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)

class  _A		(  metaclass=__magic_name__):
  SCREAMING_SNAKE_CASE    :      Dict       =  ['''flax''']

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(self ,					['flax']					)

  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)



  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)

class  _A		(  metaclass=__magic_name__):
  SCREAMING_SNAKE_CASE    :      Any       =  ['''flax''']

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(self ,					['flax']					)

  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)



  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)

class  _A		(  metaclass=__magic_name__):
  SCREAMING_SNAKE_CASE    :      Union[str, Any]       =  ['''flax''']

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(self ,					['flax']					)

  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)



  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)

class  _A		(  metaclass=__magic_name__):
  SCREAMING_SNAKE_CASE    :      Union[str, Any]       =  ['''flax''']

  def __init__(				self ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(self ,					['flax']					)

  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)



  @classmethod
  def  UpperCAmelCase    (				cls ,					*_SCREAMING_SNAKE_CASE ,					**_SCREAMING_SNAKE_CASE					):





        """simple docstring"""







        requires_backends(cls ,					['flax']					)






