



from typing import Mapping

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


A_		:     Optional[int]        =     logging.get_logger(__name__)

A_		:     Optional[Any]        =     {
    '''t5-small''': '''https://huggingface.co/t5-small/resolve/main/config.json''',
    '''t5-base''': '''https://huggingface.co/t5-base/resolve/main/config.json''',
    '''t5-large''': '''https://huggingface.co/t5-large/resolve/main/config.json''',
    '''t5-3b''': '''https://huggingface.co/t5-3b/resolve/main/config.json''',
    '''t5-11b''': '''https://huggingface.co/t5-11b/resolve/main/config.json''',
}



class 		_lowercase		(       UpperCAmelCase__	):
			_UpperCAmelCase     	=			'''t5'''
			_UpperCAmelCase     	=			['''past_key_values''']
			_UpperCAmelCase     	=			{'''hidden_size''': '''d_model''', '''num_attention_heads''': '''num_heads''', '''num_hidden_layers''': '''num_layers'''}

			def __init__(      self			:       Any							,   __lowerCAmelCase			:       Union[str, Any]=3_2128							,   __lowerCAmelCase			:       Optional[Any]=512							,   __lowerCAmelCase			:       Optional[int]=64							,   __lowerCAmelCase			:       Any=2048							,   __lowerCAmelCase			:       List[Any]=6							,   __lowerCAmelCase			:       str=None							,   __lowerCAmelCase			:       List[Any]=8							,   __lowerCAmelCase			:       str=32							,   __lowerCAmelCase			:       Dict=128							,   __lowerCAmelCase			:       List[Any]=0.1							,   __lowerCAmelCase			:       Optional[Any]=1E-6							,   __lowerCAmelCase			:       str=1.0							,   __lowerCAmelCase			:       Optional[int]="relu"							,   __lowerCAmelCase			:       Tuple=True							,   __lowerCAmelCase			:       str=True							,   __lowerCAmelCase			:       int=0							,   __lowerCAmelCase			:       Optional[Any]=1							,   **__lowerCAmelCase			:       Union[str, Any]							,   )       ->				List[str]:


				"""simple docstring"""






				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(lowercase_							) > 1 and act_info[0] != "gated" or len(lowercase_							) > 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'"							)

				# for backwards compatibility
				if feed_forward_proj == "gated-gelu":
					a						=		"gelu_new"

				super().__init__(
				    pad_token_id=lowercase_							,   eos_token_id=lowercase_							,   is_encoder_decoder=lowercase_							,   **lowercase_							,   )



class 		_lowercase		(       UpperCAmelCase__	):

			@property
			def 		A							(      self			:       int							)       ->				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_(lowercase_							,   direction="inputs"							)

				return common_inputs




			@property
			def 		A							(      self			:       Union[str, Any]							)       ->				int:


				"""simple docstring"""






				return 13






A_		:     Any        =     [4, 1, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
A_		:     Tuple        =     [3, 7, 7, 4, 2, 6, 4, 1, 5, 3, 7, 5]
A_		:     Optional[int]        =     {
    0: '''Sunday''',
    1: '''Monday''',
    2: '''Tuesday''',
    3: '''Wednesday''',
    4: '''Thursday''',
    5: '''Friday''',
    6: '''Saturday''',
}


def 	UpperCAmelCase__      (      UpperCAmelCase__ :int ,					UpperCAmelCase__ :int ,					UpperCAmelCase__ :int					):






 '''simple docstring'''

 assert len(str(UpperCAmelCase__					)					) > 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 // 1_00
 a						=		(5 * (century % 4) + 2) % 7
 a						=		year % 1_00
 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 % 4_00) == 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()

