


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


lowercase							=threading.Lock()
lowercase							=None

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

lowercase							=logging.WARNING

lowercase							=True





def lowerCamelCase__      (						):







   '''simple docstring'''




   _UpperCAmelCase       :       Tuple							   =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__      (						):







   '''simple docstring'''




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





def lowerCamelCase__      (						):







   '''simple docstring'''




   return logging.getLogger(_get_library_name()							)





def lowerCamelCase__      (						):







   '''simple docstring'''




   global _default_handler

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

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





def lowerCamelCase__      (						):







   '''simple docstring'''




   global _default_handler

   with _lock:
      if not _default_handler:
         return

      _UpperCAmelCase       :       List[str]							   =_get_library_root_logger()
      library_root_logger.removeHandler(_default_handler							)
      library_root_logger.setLevel(logging.NOTSET							)
      _UpperCAmelCase       :       Union[str, Any]							   =None





def lowerCamelCase__      (						):







   '''simple docstring'''




   return log_levels





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







   '''simple docstring'''




   if name is None:
      _UpperCAmelCase       :       int							   =_get_library_name()

   _configure_library_root_logger()
   return logging.getLogger(__lowerCamelCase							)





def lowerCamelCase__      (						):







   '''simple docstring'''




   _configure_library_root_logger()
   return _get_library_root_logger().getEffectiveLevel()





def lowerCamelCase__      (						__lowerCamelCase	:							int							):







   '''simple docstring'''




   _configure_library_root_logger()
   _get_library_root_logger().setLevel(__lowerCamelCase							)





def lowerCamelCase__      (						):







   '''simple docstring'''




   return set_verbosity(__lowerCamelCase							)





def lowerCamelCase__      (						):







   '''simple docstring'''




   return set_verbosity(__lowerCamelCase							)





def lowerCamelCase__      (						):







   '''simple docstring'''




   return set_verbosity(__lowerCamelCase							)





def lowerCamelCase__      (						):







   '''simple docstring'''




   return set_verbosity(__lowerCamelCase							)





def lowerCamelCase__      (						):







   '''simple docstring'''




   _configure_library_root_logger()

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





def lowerCamelCase__      (						):







   '''simple docstring'''




   _configure_library_root_logger()

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





def lowerCamelCase__      (						__lowerCamelCase	:							logging.Handler							):







   '''simple docstring'''




   _configure_library_root_logger()

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





def lowerCamelCase__      (						__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 lowerCamelCase__      (						):







   '''simple docstring'''




   _configure_library_root_logger()
   _UpperCAmelCase       :       List[str]							   =False





def lowerCamelCase__      (						):







   '''simple docstring'''




   _configure_library_root_logger()
   _UpperCAmelCase       :       int							   =True





def lowerCamelCase__      (						):







   '''simple docstring'''




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

   for handler in handlers:
      _UpperCAmelCase       :       Dict							   =logging.Formatter('[%(levelname)s|%(filename)s:%(lineno)s] %(asctime)s >> %(message)s'							)
      handler.setFormatter(__lowerCamelCase							)





def lowerCamelCase__      (						):







   '''simple docstring'''




   _UpperCAmelCase       :       List[Any]							   =_get_library_root_logger().handlers

   for handler in handlers:
      handler.setFormatter(__lowerCamelCase							)





def lowerCamelCase__      (						self	:							Tuple	,   *__lowerCamelCase	:							Optional[int]	,   **__lowerCamelCase	:							Tuple							):







   '''simple docstring'''




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


lowercase							=warning_advice





@functools.lru_cache(__lowerCamelCase							)
def lowerCamelCase__      (						self	:							List[str]	,   *__lowerCamelCase	:							Union[str, Any]	,   **__lowerCamelCase	:							Optional[Any]							):







   '''simple docstring'''




   self.warning(*__lowerCamelCase	,   **__lowerCamelCase							)


lowercase							=warning_once






class  __magic_name__							:






       def __init__(      self  ,							*snake_case  ,							**snake_case)						->  str:  # pylint: disable=unused-argument




          '''simple docstring'''
          _UpperCAmelCase       :       Optional[Any]							   =args[0] if args else None






       def __iter__(      self)						->  Optional[Any]:




          '''simple docstring'''
          return iter(self._iterator)






       def __getattr__(      self  ,							snake_case)						->  Optional[Any]:




          '''simple docstring'''

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

          return empty_fn






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




          '''simple docstring'''
          return self






       def __exit__(      self  ,							snake_case  ,							snake_case  ,							snake_case)						->  List[str]:




          '''simple docstring'''
          return






class  __magic_name__							:






       def __call__(      self  ,							*snake_case  ,							**snake_case)						->  str:




          '''simple docstring'''
          if _tqdm_active:
             return tqdm_lib.tqdm(*snake_case  ,							**snake_case)
          else:
             return EmptyTqdm(*snake_case  ,							**snake_case)






       def       lowerCAmelCase		(      self  ,							*snake_case  ,							**snake_case)						->  Dict:




          '''simple docstring'''
          _UpperCAmelCase       :       int							   =None
          if _tqdm_active:
             return tqdm_lib.tqdm.set_lock(*snake_case  ,							**snake_case)






       def       lowerCAmelCase		(      self)						->  int:




          '''simple docstring'''
          if _tqdm_active:
             return tqdm_lib.tqdm.get_lock()






lowercase							=_tqdm_cls()





def lowerCamelCase__      (						):







   '''simple docstring'''




   global _tqdm_active
   return bool(_tqdm_active							)





def lowerCamelCase__      (						):







   '''simple docstring'''




   global _tqdm_active
   _UpperCAmelCase       :       Optional[int]							   =True
   hf_hub_utils.enable_progress_bars()





def lowerCamelCase__      (						):







   '''simple docstring'''




   global _tqdm_active
   _UpperCAmelCase       :       Optional[Any]							   =False
   hf_hub_utils.disable_progress_bars()





'''simple docstring'''






import jax.numpy as jnp

from ...utils import logging
from ..ta.modeling_flax_ta import FlaxTaEncoderModel, FlaxTaForConditionalGeneration, FlaxTaModel
from .configuration_mta import MTaConfig


lowercase							=logging.get_logger(__name__)

lowercase							='T5Config'





def lowerCamelCase__      (						__lowerCamelCase	:							jnp.array	,   __lowerCamelCase	:							int	,   __lowerCamelCase	:							int							):







   '''simple docstring'''




   _UpperCAmelCase       :       List[Any]							   =jnp.zeros_like(__lowerCamelCase							)
   _UpperCAmelCase       :       Union[str, Any]							   =shifted_input_ids.at[:, 1:].set(input_ids[:, :-1]							)
   _UpperCAmelCase       :       List[Any]							   =shifted_input_ids.at[:, 0].set(__lowerCamelCase							)

   _UpperCAmelCase       :       str							   =jnp.where(shifted_input_ids == -1_0_0	,   __lowerCamelCase	,   __lowerCamelCase							)
   return shifted_input_ids






class  __magic_name__							(		lowerCAmelCase    ):
       UpperCAmelCase										="mt5"
       UpperCAmelCase										=MTaConfig






class  __magic_name__							(		lowerCAmelCase    ):
       UpperCAmelCase										="mt5"
       UpperCAmelCase										=MTaConfig






class  __magic_name__							(		lowerCAmelCase    ):
       UpperCAmelCase										="mt5"
       UpperCAmelCase										=MTaConfig

