"""simple docstring"""







from typing import Mapping

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


__SCREAMING_SNAKE_CASE								=logging.get_logger(__name__)

__SCREAMING_SNAKE_CASE								={
    "google/umt5-small": "https://huggingface.co/google/umt5-small/resolve/main/config.json",
    # See all umt5 models at https://huggingface.co/models?filter=umt5
}







class  UpperCamelCase	(    lowercase_						):
   lowercase							=						'umt5'
   lowercase							=						['past_key_values']
   def __init__(    self  ,__UpperCamelCase=25_0112  ,__UpperCamelCase=512  ,__UpperCamelCase=64  ,__UpperCamelCase=1024  ,__UpperCamelCase=8  ,__UpperCamelCase=None  ,__UpperCamelCase=6  ,__UpperCamelCase=32  ,__UpperCamelCase=128  ,__UpperCamelCase=0.1  ,__UpperCamelCase=1e-6  ,__UpperCamelCase=1.0  ,__UpperCamelCase="gated-gelu"  ,__UpperCamelCase=True  ,__UpperCamelCase=True  ,__UpperCamelCase="T5Tokenizer"  ,__UpperCamelCase=True  ,__UpperCamelCase=0  ,__UpperCamelCase=1  ,__UpperCamelCase=0  ,**__UpperCamelCase  ,)			->   Any:


        '''simple docstring'''


        super().__init__(
            is_encoder_decoder=__UpperCamelCase  ,tokenizer_class=__UpperCamelCase  ,tie_word_embeddings=__UpperCamelCase  ,pad_token_id=__UpperCamelCase  ,eos_token_id=__UpperCamelCase  ,decoder_start_token_id=__UpperCamelCase  ,**__UpperCamelCase  ,)
        lowercase_			:       Union[str, Any]									=			vocab_size
        lowercase_			:       Tuple									=			d_model
        lowercase_			:       Union[str, Any]									=			d_kv
        lowercase_			:       Union[str, Any]									=			d_ff
        lowercase_			:       Optional[Any]									=			num_layers
        lowercase_			:       List[str]									=			(
            num_decoder_layers if num_decoder_layers is not None else self.num_layers
        )  # default = symmetry
        lowercase_			:       Any									=			num_heads
        lowercase_			:       Dict									=			relative_attention_num_buckets
        lowercase_			:       Dict									=			relative_attention_max_distance
        lowercase_			:       Optional[Any]									=			dropout_rate
        lowercase_			:       Optional[int]									=			layer_norm_epsilon
        lowercase_			:       Dict									=			initializer_factor
        lowercase_			:       List[str]									=			feed_forward_proj
        lowercase_			:       int									=			use_cache

        lowercase_			:       str									=			self.feed_forward_proj.split('-'    )
        lowercase_			:       List[str]									=			act_info[-1]
        lowercase_			:       Union[str, Any]									=			act_info[0] == 'gated'

        if len(__UpperCamelCase    ) > 1 and act_info[0] != "gated" or len(__UpperCamelCase    ) > 2:
             raise ValueError(
                 f'''`feed_forward_proj`: {feed_forward_proj} is not a valid activation function of the dense layer.'''
                 'Please make sure `feed_forward_proj` is of the format `gated-{ACT_FN}` or `{ACT_FN}`, e.g. '
                 '\'gated-gelu\' or \'relu\''    )

        if feed_forward_proj == "gated-gelu":
             lowercase_			:       Optional[Any]									=			'gelu_new'
   @property
   def     _UpperCAmelCase     (    self    )			->   Optional[Any]:


        '''simple docstring'''


        return self.d_model
   @property
   def     _UpperCAmelCase     (    self    )			->   Union[str, Any]:


        '''simple docstring'''


        return self.num_heads







   @property
   def     _UpperCAmelCase     (    self    )			->   Dict:


        '''simple docstring'''


        return self.num_layers







class  UpperCamelCase	(    lowercase_						):
   @property
   # Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.inputs
   def     _UpperCAmelCase     (    self    )			->   Mapping[str, Mapping[int, str]]:


        '''simple docstring'''


        lowercase_			:       Tuple									=			{
            'input_ids': {0: 'batch', 1: 'encoder_sequence'},
            'attention_mask': {0: 'batch', 1: 'encoder_sequence'},
        }
        if self.use_past:
             lowercase_			:       str									=			'past_encoder_sequence + sequence'
             lowercase_			:       str									=			{0: 'batch'}
             lowercase_			:       Union[str, Any]									=			{0: 'batch', 1: 'past_decoder_sequence + sequence'}
        else:
             lowercase_			:       str									=			{0: 'batch', 1: 'decoder_sequence'}
             lowercase_			:       Union[str, Any]									=			{0: 'batch', 1: 'decoder_sequence'}

        if self.use_past:
             self.fill_with_past_key_values_(__UpperCamelCase  ,direction='inputs'    )

        return common_inputs
   @property
   # Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.default_onnx_opset
   def     _UpperCAmelCase     (    self    )			->   int:


        '''simple docstring'''


        return 13







   @property
   def     _UpperCAmelCase     (    self    )			->   float:


        '''simple docstring'''


        return 5e-4


"""simple docstring"""







import logging
import os
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


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

__SCREAMING_SNAKE_CASE								=logging.WARNING



def     lowercase__( ):
     lowercase_			:       List[Any]									=			os.getenv('DATASETS_VERBOSITY'  ,    __SCREAMING_SNAKE_CASE   )
     if env_level_str:
          if env_level_str in log_levels:
               return log_levels[env_level_str]
          else:
               logging.getLogger().warning(
                   F'''Unknown option DATASETS_VERBOSITY={env_level_str}, '''
                   F'''has to be one of: { ", ".join(log_levels.keys()   ) }'''   )
     return _default_log_level



def     lowercase__( ):
     return __name__.split('.'   )[0]



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



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



def     lowercase__( ):
     lowercase_			:       int									=			_get_library_root_logger()
     library_root_logger.setLevel(logging.NOTSET   )



def     lowercase__( __SCREAMING_SNAKE_CASE							:  Optional[str] = None   ):
     if name is None:
          lowercase_			:       Union[str, Any]									=			_get_library_name()
     return logging.getLogger(__SCREAMING_SNAKE_CASE   )



def     lowercase__( ):
     return _get_library_root_logger().getEffectiveLevel()



def     lowercase__( __SCREAMING_SNAKE_CASE							:  int   ):
     _get_library_root_logger().setLevel(__SCREAMING_SNAKE_CASE   )



def     lowercase__( ):
     return set_verbosity(__SCREAMING_SNAKE_CASE   )



def     lowercase__( ):
     return set_verbosity(__SCREAMING_SNAKE_CASE   )



def     lowercase__( ):
     return set_verbosity(__SCREAMING_SNAKE_CASE   )



def     lowercase__( ):
     return set_verbosity(__SCREAMING_SNAKE_CASE   )



def     lowercase__( ):
     lowercase_			:       Tuple									=			False



def     lowercase__( ):
     lowercase_			:       Any									=			True


# Configure the library root logger at the module level (singleton-like)
_configure_library_root_logger()







class  UpperCamelCase	:
   def __init__(    self  ,*__UpperCamelCase  ,**__UpperCamelCase    )			->   int:  # pylint: disable=unused-argument


        '''simple docstring'''


        lowercase_			:       Optional[Any]									=			args[0] if args else None
   def __iter__(    self    )			->   Union[str, Any]:


        '''simple docstring'''


        return iter(self._iterator    )
   def __getattr__(    self  ,__UpperCamelCase    )			->   List[Any]:


        '''simple docstring'''


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

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


        '''simple docstring'''


        return self







   def __exit__(    self  ,__UpperCamelCase  ,__UpperCamelCase  ,__UpperCamelCase    )			->   Dict:


        '''simple docstring'''


        return






__SCREAMING_SNAKE_CASE								=True







class  UpperCamelCase	:
   def __call__(    self  ,*__UpperCamelCase  ,__UpperCamelCase=False  ,**__UpperCamelCase    )			->   Tuple:


        '''simple docstring'''


        if _tqdm_active and not disable:
             return tqdm_lib.tqdm(*__UpperCamelCase  ,**__UpperCamelCase    )
        else:
             return EmptyTqdm(*__UpperCamelCase  ,**__UpperCamelCase    )
   def     _UpperCAmelCase     (    self  ,*__UpperCamelCase  ,**__UpperCamelCase    )			->   str:


        '''simple docstring'''


        lowercase_			:       Tuple									=			None
        if _tqdm_active:
             return tqdm_lib.tqdm.set_lock(*__UpperCamelCase  ,**__UpperCamelCase    )







   def     _UpperCAmelCase     (    self    )			->   Any:


        '''simple docstring'''


        if _tqdm_active:
             return tqdm_lib.tqdm.get_lock()






__SCREAMING_SNAKE_CASE								=_tqdm_cls()



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



def     lowercase__( ):
     global _tqdm_active
     lowercase_			:       Union[str, Any]									=			True







def     lowercase__( ):
     global _tqdm_active
     lowercase_			:       Optional[int]									=			False

