

from typing import Mapping

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


__lowercase				      =						logging.get_logger(__name__)

__lowercase				      =						{
    """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    _lowercase				(					__lowerCamelCase			):
   _lowercase     :       Tuple  					=    'umt5'
   _lowercase     :       Optional[Any]  					=    ['past_key_values']

   def __init__(				self	:    int			,						lowerCamelCase__	:    Any=2_5_0_1_1_2			,						lowerCamelCase__	:    Union[str, Any]=5_1_2			,						lowerCamelCase__	:    Tuple=6_4			,						lowerCamelCase__	:    Tuple=1_0_2_4			,						lowerCamelCase__	:    Optional[int]=8			,						lowerCamelCase__	:    Dict=None			,						lowerCamelCase__	:    Any=6			,						lowerCamelCase__	:    List[Any]=3_2			,						lowerCamelCase__	:    Tuple=1_2_8			,						lowerCamelCase__	:    List[str]=0.1			,						lowerCamelCase__	:    List[str]=1e-6			,						lowerCamelCase__	:    Dict=1.0			,						lowerCamelCase__	:    List[Any]="gated-gelu"			,						lowerCamelCase__	:    int=True			,						lowerCamelCase__	:    List[Any]=True			,						lowerCamelCase__	:    Any="T5Tokenizer"			,						lowerCamelCase__	:    List[str]=True			,						lowerCamelCase__	:    Any=0			,						lowerCamelCase__	:    str=1			,						lowerCamelCase__	:    Optional[Any]=0			,						**lowerCamelCase__	:    str			,						) ->			str:
         """simple docstring"""





         super().__init__(
             is_encoder_decoder=lowerCamelCase__			,						tokenizer_class=lowerCamelCase__			,						tie_word_embeddings=lowerCamelCase__			,						pad_token_id=lowerCamelCase__			,						eos_token_id=lowerCamelCase__			,						decoder_start_token_id=lowerCamelCase__			,						**lowerCamelCase__			,						)
         A_							       =		vocab_size
         A_							       =		d_model
         A_							       =		d_kv
         A_							       =		d_ff
         A_							       =		num_layers
         A_							       =		(
             num_decoder_layers if num_decoder_layers is not None else self.num_layers
         )  # default = symmetry
         A_							       =		num_heads
         A_							       =		relative_attention_num_buckets
         A_							       =		relative_attention_max_distance
         A_							       =		dropout_rate
         A_							       =		layer_norm_epsilon
         A_							       =		initializer_factor
         A_							       =		feed_forward_proj
         A_							       =		use_cache

         A_							       =		self.feed_forward_proj.split('''-'''       )
         A_							       =		act_info[-1]
         A_							       =		act_info[0] == '''gated'''

         if len(lowerCamelCase__       ) > 1 and act_info[0] != "gated" or len(lowerCamelCase__       ) > 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":
               A_							       =		'''gelu_new'''

   @property
   def     UpperCamelCase					(				self	:    List[Any]       ) ->			Any:
         """simple docstring"""





         return self.d_model

   @property
   def     UpperCamelCase					(				self	:    List[str]       ) ->			Optional[int]:
         """simple docstring"""





         return self.num_heads





   @property
   def     UpperCamelCase					(				self	:    int       ) ->			List[Any]:
         """simple docstring"""





         return self.num_layers



class    _lowercase				(					__lowerCamelCase			):

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





         A_							       =		{
             '''input_ids''': {0: '''batch''', 1: '''encoder_sequence'''},
             '''attention_mask''': {0: '''batch''', 1: '''encoder_sequence'''},
         }
         if self.use_past:
               A_							       =		'''past_encoder_sequence + sequence'''
               A_							       =		{0: '''batch'''}
               A_							       =		{0: '''batch''', 1: '''past_decoder_sequence + sequence'''}
         else:
               A_							       =		{0: '''batch''', 1: '''decoder_sequence'''}
               A_							       =		{0: '''batch''', 1: '''decoder_sequence'''}

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

         return common_inputs

   @property
   # Copied from transformers.models.t5.configuration_t5.T5OnnxConfig.default_onnx_opset
   def     UpperCamelCase					(				self	:    Dict       ) ->			int:
         """simple docstring"""





         return 1_3





   @property
   def     UpperCamelCase					(				self	:    List[str]       ) ->			float:
         """simple docstring"""





         return 5e-4








__lowercase				      =						[4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
__lowercase				      =						[3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
__lowercase				      =						{
    0: """Sunday""",
    1: """Monday""",
    2: """Tuesday""",
    3: """Wednesday""",
    4: """Thursday""",
    5: """Friday""",
    6: """Saturday""",
}







def 							_lowerCamelCase   (			SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE		,				SCREAMING_SNAKE_CASE   ):
      '''simple docstring'''







      assert len(str(SCREAMING_SNAKE_CASE   )   ) > 2, "year should be in YYYY format"
      assert 1 <= month <= 12, "month should be between 1 to 12"
      assert 1 <= day <= 31, "day should be between 1 to 31"

      # Doomsday algorithm:
      A_							       =		year // 100
      A_							       =		(5 * (century % 4) + 2) % 7
      A_							       =		year % 100
      A_							       =		centurian % 12
      A_							       =		(
          (centurian // 12) + centurian_m + (centurian_m // 4) + century_anchor
      ) % 7
      A_							       =		(
          DOOMSDAY_NOT_LEAP[month - 1]
          if (year % 4 != 0) or (centurian == 0 and (year % 400) == 0)
          else DOOMSDAY_LEAP[month - 1]
      )
      A_							       =		(dooms_day + day - day_anchor) % 7
      return WEEK_DAY_NAMES[week_day]


if __name__ == "__main__":
      import doctest

      doctest.testmod()





