'''simple docstring'''

from collections import OrderedDict
from typing import Any, Mapping, Optional

from ... import PreTrainedTokenizer
from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig, OnnxConfigWithPast, OnnxSeqaSeqConfigWithPast
from ...onnx.utils import compute_effective_axis_dimension
from ...utils import TensorType, is_torch_available, logging


__a:					Optional[Any]			  =  logging.get_logger(__name__)

__a:					Union[str, Any]			  =  {
    """Helsinki-NLP/opus-mt-en-de""": """https://huggingface.co/Helsinki-NLP/opus-mt-en-de/resolve/main/config.json""",
    # See all Marian models at https://huggingface.co/models?filter=marian
}



class      UpperCAmelCase    (		UpperCamelCase__   ):





       '''simple docstring'''



       SCREAMING_SNAKE_CASE   						=       "marian"
       SCREAMING_SNAKE_CASE   						=       ["past_key_values"]
       SCREAMING_SNAKE_CASE   						=       {"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}

       def __init__(		self      ,  __lowerCAmelCase=58101      ,  __lowerCAmelCase=None      ,  __lowerCAmelCase=1024      ,  __lowerCAmelCase=12      ,  __lowerCAmelCase=4096      ,  __lowerCAmelCase=16      ,  __lowerCAmelCase=12      ,  __lowerCAmelCase=4096      ,  __lowerCAmelCase=16      ,  __lowerCAmelCase=0.0      ,  __lowerCAmelCase=0.0      ,  __lowerCAmelCase=True      ,  __lowerCAmelCase=True      ,  __lowerCAmelCase="gelu"      ,  __lowerCAmelCase=1024      ,  __lowerCAmelCase=0.1      ,  __lowerCAmelCase=0.0      ,  __lowerCAmelCase=0.0      ,  __lowerCAmelCase=0.0_2      ,  __lowerCAmelCase=58100      ,  __lowerCAmelCase=False      ,  __lowerCAmelCase=58100      ,  __lowerCAmelCase=0      ,  __lowerCAmelCase=0      ,  __lowerCAmelCase=True      ,  **__lowerCAmelCase      ,  )    ->    Dict:
        lowercase__							:       Dict										=   vocab_size
        lowercase__							:       Tuple										=   decoder_vocab_size or vocab_size
        lowercase__							:       Dict										=   max_position_embeddings
        lowercase__							:       Tuple										=   d_model
        lowercase__							:       Tuple										=   encoder_ffn_dim
        lowercase__							:       List[Any]										=   encoder_layers
        lowercase__							:       Dict										=   encoder_attention_heads
        lowercase__							:       List[str]										=   decoder_ffn_dim
        lowercase__							:       str										=   decoder_layers
        lowercase__							:       str										=   decoder_attention_heads
        lowercase__							:       List[Any]										=   dropout
        lowercase__							:       Optional[Any]										=   attention_dropout
        lowercase__							:       Union[str, Any]										=   activation_dropout
        lowercase__							:       str										=   activation_function
        lowercase__							:       Any										=   init_std
        lowercase__							:       Optional[Any]										=   encoder_layerdrop
        lowercase__							:       str										=   decoder_layerdrop
        lowercase__							:       int										=   use_cache
        lowercase__							:       List[Any]										=   encoder_layers
        lowercase__							:       Optional[Any]										=   scale_embedding  # scale factor will be sqrt(d_model) if True
        lowercase__							:       Optional[Any]										=   share_encoder_decoder_embeddings
        super().__init__(
            pad_token_id=__A      ,  eos_token_id=__A      ,  is_encoder_decoder=__A      ,  decoder_start_token_id=__A      ,  forced_eos_token_id=__A      ,  **__A      ,  )



class      UpperCAmelCase    (		UpperCamelCase__   ):





       '''simple docstring'''



       @property
       # Copied from transformers.models.bart.configuration_bart.BartOnnxConfig.inputs
       def _lowerCAmelCase(		self					)    ->    Mapping[str, Mapping[int, str]]:



        if self.task in ["default", "seq2seq-lm"]:
         lowercase__							:       Tuple										=   OrderedDict(
             [
                 ('''input_ids''', {0: '''batch''', 1: '''encoder_sequence'''}),
                 ('''attention_mask''', {0: '''batch''', 1: '''encoder_sequence'''}),
             ]					)

         if self.use_past:
          lowercase__							:       List[str]										=   {0: '''batch'''}
          lowercase__							:       Optional[Any]										=   {0: '''batch''', 1: '''past_decoder_sequence + sequence'''}
         else:
          lowercase__							:       Tuple										=   {0: '''batch''', 1: '''decoder_sequence'''}
          lowercase__							:       List[Any]										=   {0: '''batch''', 1: '''decoder_sequence'''}

         if self.use_past:
          self.fill_with_past_key_values_(__A      ,  direction='''inputs'''					)
        elif self.task == "causal-lm":
         # TODO: figure this case out.
         lowercase__							:       str										=   OrderedDict(
             [
                 ('''input_ids''', {0: '''batch''', 1: '''encoder_sequence'''}),
                 ('''attention_mask''', {0: '''batch''', 1: '''encoder_sequence'''}),
             ]					)
         if self.use_past:
          lowercase__					,				lowercase__							:       int										=   self.num_layers
          for i in range(__A					):
           lowercase__							:       Dict										=   {0: '''batch''', 2: '''past_sequence + sequence'''}
           lowercase__							:       int										=   {0: '''batch''', 2: '''past_sequence + sequence'''}
        else:
         lowercase__							:       Union[str, Any]										=   OrderedDict(
             [
                 ('''input_ids''', {0: '''batch''', 1: '''encoder_sequence'''}),
                 ('''attention_mask''', {0: '''batch''', 1: '''encoder_sequence'''}),
                 ('''decoder_input_ids''', {0: '''batch''', 1: '''decoder_sequence'''}),
                 ('''decoder_attention_mask''', {0: '''batch''', 1: '''decoder_sequence'''}),
             ]					)

        return common_inputs

       @property
       # Copied from transformers.models.bart.configuration_bart.BartOnnxConfig.outputs
       def _lowerCAmelCase(		self					)    ->    Mapping[str, Mapping[int, str]]:



        if self.task in ["default", "seq2seq-lm"]:
         lowercase__							:       Any										=   super().outputs
        else:
         lowercase__							:       str										=   super(__A      ,  self					).outputs
         if self.use_past:
          lowercase__					,				lowercase__							:       Optional[Any]										=   self.num_layers
          for i in range(__A					):
           lowercase__							:       Union[str, Any]										=   {0: '''batch''', 2: '''past_sequence + sequence'''}
           lowercase__							:       Tuple										=   {0: '''batch''', 2: '''past_sequence + sequence'''}
        return common_outputs

       def _lowerCAmelCase(		self      ,  __lowerCAmelCase      ,  __lowerCAmelCase = -1      ,  __lowerCAmelCase = -1      ,  __lowerCAmelCase = False      ,  __lowerCAmelCase = None      ,  )    ->    Mapping[str, Any]:
        lowercase__							:       str										=   self._generate_dummy_inputs_for_encoder_and_decoder(
            __A      ,  __A      ,  __A      ,  __A      ,  __A					)

        # Generate decoder inputs
        lowercase__							:       Any										=   seq_length if not self.use_past else 1
        lowercase__							:       List[Any]										=   self._generate_dummy_inputs_for_encoder_and_decoder(
            __A      ,  __A      ,  __A      ,  __A      ,  __A					)
        lowercase__							:       str										=   {F"""decoder_{name}""": tensor for name, tensor in decoder_inputs.items()}
        lowercase__							:       List[str]										=   dict(**__A      ,  **__A					)

        if self.use_past:
         if not is_torch_available():
          raise ValueError('''Cannot generate dummy past_keys inputs without PyTorch installed.'''					)
         else:
          import torch
         lowercase__					,				lowercase__							:       Tuple										=   common_inputs['''input_ids'''].shape
         lowercase__							:       Any										=   common_inputs['''decoder_input_ids'''].shape[1]
         lowercase__					,				lowercase__							:       Any										=   self.num_attention_heads
         lowercase__							:       List[Any]										=   (
             batch,
             num_encoder_attention_heads,
             encoder_seq_length,
             self._config.hidden_size // num_encoder_attention_heads,
         )
         lowercase__							:       Union[str, Any]										=   decoder_seq_length + 3
         lowercase__							:       str										=   (
             batch,
             num_decoder_attention_heads,
             decoder_past_length,
             self._config.hidden_size // num_decoder_attention_heads,
         )

         lowercase__							:       Any										=   torch.cat(
             [common_inputs['''decoder_attention_mask'''], torch.ones(__A      ,  __A					)]      ,  dim=1					)

         lowercase__							:       Union[str, Any]										=   []
         # If the number of encoder and decoder layers are present in the model configuration, both are considered
         lowercase__					,				lowercase__							:       Dict										=   self.num_layers
         lowercase__							:       Union[str, Any]										=   min(__A      ,  __A					)
         lowercase__							:       str										=   max(__A      ,  __A					) - min_num_layers
         lowercase__							:       str										=   '''encoder''' if num_encoder_layers > num_decoder_layers else '''decoder'''

         for _ in range(__A					):
          common_inputs["past_key_values"].append(
              (
                  torch.zeros(__A					),
                  torch.zeros(__A					),
                  torch.zeros(__A					),
                  torch.zeros(__A					),
              )					)
         # TODO: test this.
         lowercase__							:       Any										=   encoder_shape if remaining_side_name == '''encoder''' else decoder_shape
         for _ in range(__A      ,  __A					):
          common_inputs["past_key_values"].append((torch.zeros(__A					), torch.zeros(__A					))					)
        return common_inputs

       def _lowerCAmelCase(		self      ,  __lowerCAmelCase      ,  __lowerCAmelCase = -1      ,  __lowerCAmelCase = -1      ,  __lowerCAmelCase = False      ,  __lowerCAmelCase = None      ,  )    ->    Mapping[str, Any]:
        lowercase__							:       Any										=   self._generate_dummy_inputs_for_encoder_and_decoder(
            __A      ,  __A      ,  __A      ,  __A      ,  __A					)

        if self.use_past:
         if not is_torch_available():
          raise ValueError('''Cannot generate dummy past_keys inputs without PyTorch installed.'''					)
         else:
          import torch
         lowercase__					,				lowercase__							:       int										=   common_inputs['''input_ids'''].shape
         # Not using the same length for past_key_values
         lowercase__							:       str										=   seqlen + 2
         lowercase__					,				lowercase__							:       List[str]										=   self.num_layers
         lowercase__					,				lowercase__							:       Optional[int]										=   self.num_attention_heads
         lowercase__							:       List[str]										=   (
             batch,
             num_encoder_attention_heads,
             past_key_values_length,
             self._config.hidden_size // num_encoder_attention_heads,
         )

         lowercase__							:       Dict										=   common_inputs['''attention_mask'''].dtype
         lowercase__							:       Optional[int]										=   torch.cat(
             [common_inputs['''attention_mask'''], torch.ones(__A      ,  __A      ,  dtype=__A					)]      ,  dim=1					)
         lowercase__							:       str										=   [
             (torch.zeros(__A					), torch.zeros(__A					)) for _ in range(__A					)
         ]
        return common_inputs

       def _lowerCAmelCase(		self      ,  __lowerCAmelCase      ,  __lowerCAmelCase = -1      ,  __lowerCAmelCase = -1      ,  __lowerCAmelCase = False      ,  __lowerCAmelCase = None      ,  )    ->    Mapping[str, Any]:
        lowercase__							:       Dict										=   compute_effective_axis_dimension(
            __A      ,  fixed_dimension=OnnxConfig.default_fixed_batch      ,  num_token_to_add=0					)

        # If dynamic axis (-1) we forward with a fixed dimension of 8 tokens to avoid optimizations made by ONNX
        lowercase__							:       Tuple										=   tokenizer.num_special_tokens_to_add(__A					)
        lowercase__							:       Tuple										=   compute_effective_axis_dimension(
            __A      ,  fixed_dimension=OnnxConfig.default_fixed_sequence      ,  num_token_to_add=__A					)

        # Generate dummy inputs according to compute batch and sequence
        lowercase__							:       List[Any]										=   [''' '''.join([tokenizer.unk_token]					) * seq_length] * batch_size
        lowercase__							:       Any										=   dict(tokenizer(__A      ,  return_tensors=__A					)					)
        return common_inputs

       def _lowerCAmelCase(		self      ,  __lowerCAmelCase      ,  __lowerCAmelCase = -1      ,  __lowerCAmelCase = -1      ,  __lowerCAmelCase = False      ,  __lowerCAmelCase = None      ,  )    ->    Mapping[str, Any]:



        if self.task in ["default", "seq2seq-lm"]:
         lowercase__							:       Any										=   self._generate_dummy_inputs_for_default_and_seqaseq_lm(
             __A      ,  batch_size=__A      ,  seq_length=__A      ,  is_pair=__A      ,  framework=__A					)

        else:
         lowercase__							:       List[Any]										=   self._generate_dummy_inputs_for_causal_lm(
             __A      ,  batch_size=__A      ,  seq_length=__A      ,  is_pair=__A      ,  framework=__A					)

        return common_inputs

       def _lowerCAmelCase(		self      ,  __lowerCAmelCase      ,  __lowerCAmelCase      ,  __lowerCAmelCase      ,  __lowerCAmelCase					)    ->    str:



        if self.task in ["default", "seq2seq-lm"]:
         lowercase__							:       Optional[int]										=   super()._flatten_past_key_values_(__A      ,  __A      ,  __A      ,  __A					)
        else:
         lowercase__							:       Optional[Any]										=   super(__A      ,  self					)._flatten_past_key_values_(
             __A      ,  __A      ,  __A      ,  __A					)


       @property
       def _lowerCAmelCase(		self					)    ->    float:
        return 1E-4








import argparse
import datetime






def 					SCREAMING_SNAKE_CASE__				(							UpperCamelCase__:				str     ):
		SCREAMING_SNAKE_CASE__								=   {
		    """0""": """Sunday""",
		    """1""": """Monday""",
		    """2""": """Tuesday""",
		    """3""": """Wednesday""",
		    """4""": """Thursday""",
		    """5""": """Friday""",
		    """6""": """Saturday""",
		}

		SCREAMING_SNAKE_CASE__								=   {0: 1, 1: 2, 2: 3, 3: 4, 4: 5, 5: 6, 6: 0}

		# Validate
		if not 0 < len(UpperCamelCase__     ) < 11:
				raise ValueError("""Must be 10 characters long"""     )

		# Get month
		SCREAMING_SNAKE_CASE__								=   int(date_input[0] + date_input[1]     )
		# Validate
		if not 0 < m < 13:
				raise ValueError("""Month must be between 1 - 12"""     )

		SCREAMING_SNAKE_CASE__								=   date_input[2]
		# Validate
		if sep_a not in ["-", "/"]:
				raise ValueError("""Date separator must be '-' or '/'"""     )

		# Get day
		SCREAMING_SNAKE_CASE__								=   int(date_input[3] + date_input[4]     )
		# Validate
		if not 0 < d < 32:
				raise ValueError("""Date must be between 1 - 31"""     )

		# Get second separator
		SCREAMING_SNAKE_CASE__								=   date_input[5]
		# Validate
		if sep_a not in ["-", "/"]:
				raise ValueError("""Date separator must be '-' or '/'"""     )

		# Get year
		SCREAMING_SNAKE_CASE__								=   int(date_input[6] + date_input[7] + date_input[8] + date_input[9]     )
		# Arbitrary year range
		if not 45 < y < 8_500:
				raise ValueError(
				    """Year out of range. There has to be some sort of limit...right?"""     )

		# Get datetime obj for validation
		SCREAMING_SNAKE_CASE__								=   datetime.date(int(UpperCamelCase__     )       , int(UpperCamelCase__     )       , int(UpperCamelCase__     )     )

		# Start math
		if m <= 2:
				SCREAMING_SNAKE_CASE__								=   y - 1
				SCREAMING_SNAKE_CASE__								=   m + 12
		# maths var
		SCREAMING_SNAKE_CASE__								=   int(str(UpperCamelCase__     )[:2]     )
		SCREAMING_SNAKE_CASE__								=   int(str(UpperCamelCase__     )[2:]     )
		SCREAMING_SNAKE_CASE__								=   int(2.6 * m - 5.3_9     )
		SCREAMING_SNAKE_CASE__								=   int(c / 4     )
		SCREAMING_SNAKE_CASE__								=   int(k / 4     )
		SCREAMING_SNAKE_CASE__								=   int(d + k     )
		SCREAMING_SNAKE_CASE__								=   int(t + u + v + x     )
		SCREAMING_SNAKE_CASE__								=   int(z - (2 * c)     )
		SCREAMING_SNAKE_CASE__								=   round(w % 7     )
		# End math

		# Validate math
		if f != convert_datetime_days[dt_ck.weekday()]:
				raise AssertionError("""The date was evaluated incorrectly. Contact developer."""     )

		# Response
		SCREAMING_SNAKE_CASE__								=   f'''Your date {date_input}, is a {days[str(UpperCamelCase__     )]}!'''
		return response


if __name__ == "__main__":
	import doctest

	doctest.testmod()
	_lowerCamelCase 					=      argparse.ArgumentParser(
	    description=(
	        'Find out what day of the week nearly any date is or was. Enter '
	        'date as a string in the mm-dd-yyyy or mm/dd/yyyy format'
	    )
	)
	parser.add_argument(
	    'date_input', type=str, help='Date as a string (mm-dd-yyyy or mm/dd/yyyy)'
	)
	_lowerCamelCase 					=      parser.parse_args()
	zeller(args.date_input)