


"""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


__snake_case    					=					threading.Lock()
__snake_case    					=					None

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

__snake_case    					=					logging.WARNING

__snake_case    					=					True


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


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


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


def    _lowerCamelCase   (     ):
 global _default_handler

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

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


def    _lowerCamelCase   (     ):
 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__       :       Dict				=						None


def    _lowerCamelCase   (     ):
 return log_levels


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

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

 _configure_library_root_logger()
 return logging.getLogger(lowerCamelCase__  )


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


def    _lowerCamelCase   (     lowerCamelCase__	:							int  ):
 _configure_library_root_logger()
 _get_library_root_logger().setLevel(lowerCamelCase__  )


def    _lowerCamelCase   (     ):
 return set_verbosity(lowerCamelCase__  )


def    _lowerCamelCase   (     ):
 return set_verbosity(lowerCamelCase__  )


def    _lowerCamelCase   (     ):
 return set_verbosity(lowerCamelCase__  )


def    _lowerCamelCase   (     ):
 return set_verbosity(lowerCamelCase__  )


def    _lowerCamelCase   (     ):
 _configure_library_root_logger()

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


def    _lowerCamelCase   (     ):
 _configure_library_root_logger()

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


def    _lowerCamelCase   (     lowerCamelCase__	:							logging.Handler  ):
 _configure_library_root_logger()

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


def    _lowerCamelCase   (     lowerCamelCase__	:							logging.Handler  ):
 _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    _lowerCamelCase   (     ):
 _configure_library_root_logger()
 lowercase__       :       int				=						False


def    _lowerCamelCase   (     ):
 _configure_library_root_logger()
 lowercase__       :       Union[str, Any]				=						True


def    _lowerCamelCase   (     ):
 lowercase__       :       Optional[Any]				=						_get_library_root_logger().handlers

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


def    _lowerCamelCase   (     ):
 lowercase__       :       int				=						_get_library_root_logger().handlers

 for handler in handlers:
  handler.setFormatter(lowerCamelCase__  )


def    _lowerCamelCase   (     self	:							int       ,		*lowerCamelCase__	:							int       ,		**lowerCamelCase__	:							Optional[int]  ):
 lowercase__       :       int				=						os.getenv("""TRANSFORMERS_NO_ADVISORY_WARNINGS"""       ,		lowerCamelCase__  )
 if no_advisory_warnings:
  return
 self.warning(*lowerCamelCase__       ,		**lowerCamelCase__  )


__snake_case    					=					warning_advice


@functools.lru_cache(lowerCamelCase__  )
def    _lowerCamelCase   (     self	:							Tuple       ,		*lowerCamelCase__	:							str       ,		**lowerCamelCase__	:							Optional[Any]  ):
 self.warning(*lowerCamelCase__       ,		**lowerCamelCase__  )


__snake_case    					=					warning_once

class 				_SCREAMING_SNAKE_CASE				:
   """simple docstring"""



   def __init__(						self ,     *lowerCamelCase__ ,     **lowerCamelCase__						)      ->							str:  # pylint: disable=unused-argument
    lowercase__       :       str				=						args[0] if args else None


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


   def __getattr__(						self ,     lowerCamelCase__						)      ->							int:

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

    return empty_fn


   def __enter__(						self						)      ->							Optional[int]:
    return self







   def __exit__(						self ,     lowerCamelCase__ ,     lowerCamelCase__ ,     lowerCamelCase__						)      ->							Dict:
    return

class 				_SCREAMING_SNAKE_CASE				:
   """simple docstring"""



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


   def 					UpperCAmelCase__(						self ,     *lowerCamelCase__ ,     **lowerCamelCase__						)      ->							str:
    lowercase__       :       List[Any]				=						None
    if _tqdm_active:
     return tqdm_lib.tqdm.set_lock(*lowerCamelCase__ ,     **lowerCamelCase__						)







   def 					UpperCAmelCase__(						self						)      ->							Dict:
    if _tqdm_active:
     return tqdm_lib.tqdm.get_lock()
__snake_case    					=					_tqdm_cls()


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


def    _lowerCamelCase   (     ):
 global _tqdm_active
 lowercase__       :       List[str]				=						True
 hf_hub_utils.enable_progress_bars()






def    _lowerCamelCase   (     ):
 global _tqdm_active
 lowercase__       :       Union[str, Any]				=						False
 hf_hub_utils.disable_progress_bars()



"""simple docstring"""


from typing import TYPE_CHECKING

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


__snake_case    					=					{'configuration_mmbt': ['MMBTConfig']}

try:
   if not is_torch_available():
      raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
   pass
else:
   __snake_case    					=					['MMBTForClassification', 'MMBTModel', 'ModalEmbeddings']


if TYPE_CHECKING:
   from .configuration_mmbt import MMBTConfig

   try:
      if not is_torch_available():
         raise OptionalDependencyNotAvailable()
   except OptionalDependencyNotAvailable:
      pass
   else:
      from .modeling_mmbt import MMBTForClassification, MMBTModel, ModalEmbeddings

else:
   import sys

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