





'''simple docstring'''






import time
import warnings
from abc import ABC
from copy import deepcopy
from typing import Optional

import torch

from ..utils import add_start_docstrings, logging


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


__lowerCamelCase						: int		=   R'\n    Args:\n        input_ids (`torch.LongTensor` of shape `(batch_size, sequence_length)`):\n            Indices of input sequence tokens in the vocabulary.\n\n            Indices can be obtained using [`AutoTokenizer`]. See [`PreTrainedTokenizer.encode`] and\n            [`PreTrainedTokenizer.__call__`] for details.\n\n            [What are input IDs?](../glossary#input-ids)\n        scores (`torch.FloatTensor` of shape `(batch_size, config.vocab_size)`):\n            Prediction scores of a language modeling head. These can be scores for each vocabulary token before SoftMax\n            or scores for each vocabulary token after SoftMax.\n        kwargs (`Dict[str, Any]`, *optional*):\n            Additional stopping criteria specific kwargs.\n\n    Return:\n        `bool`. `False` indicates we should continue, `True` indicates we should stop.\n\n'







class 		UpperCAmelCase   (				lowercase_):


  """simple docstring"""







  @add_start_docstrings(UpperCamelCase__  )
  def __call__(				self    :					int							,	UpperCamelCase__    :					torch.LongTensor							,	UpperCamelCase__    :					torch.FloatTensor							,	**UpperCamelCase__    :					int  )     ->						bool:
    raise NotImplementedError('''StoppingCriteria needs to be subclassed'''  )







class 		UpperCAmelCase   (				lowercase_):


  """simple docstring"""







  def __init__(				self    :					Dict							,	UpperCamelCase__    :					int							,	UpperCamelCase__    :					Optional[int] = None  )     ->						Union[str, Any]:
    _UpperCamelCase       			=max_length
    _UpperCamelCase       			=max_position_embeddings




  @add_start_docstrings(UpperCamelCase__  )
  def __call__(				self    :					Dict							,	UpperCamelCase__    :					torch.LongTensor							,	UpperCamelCase__    :					torch.FloatTensor							,	**UpperCamelCase__    :					Dict  )     ->						bool:
    _UpperCamelCase       			=input_ids.shape[-1]
    _UpperCamelCase       			=cur_len >= self.max_length
    if self.max_position_embeddings is not None and not is_done and cur_len >= self.max_position_embeddings:
      logger.warning_once(
          '''This is a friendly reminder - the current text generation call will exceed the model\'s predefined '''
          F'''maximum length ({self.max_position_embeddings}). Depending on the model, you may observe '''
          '''exceptions, performance degradation, or nothing at all.'''  )
    return is_done







class 		UpperCAmelCase   (				lowercase_):


  """simple docstring"""







  def __init__(				self    :					Optional[int]							,	UpperCamelCase__    :					int							,	UpperCamelCase__    :					int  )     ->						Optional[int]:
    warnings.warn(
        '''The class `MaxNewTokensCriteria` is deprecated. '''
        F'''Please use `MaxLengthCriteria(max_length={start_length + max_new_tokens})` '''
        '''with `max_length = start_length + max_new_tokens` instead.'''							,	UpperCamelCase__							,	)
    _UpperCamelCase       			=start_length
    _UpperCamelCase       			=max_new_tokens
    _UpperCamelCase       			=start_length + max_new_tokens




  @add_start_docstrings(UpperCamelCase__  )
  def __call__(				self    :					Optional[Any]							,	UpperCamelCase__    :					torch.LongTensor							,	UpperCamelCase__    :					torch.FloatTensor							,	**UpperCamelCase__    :					Tuple  )     ->						bool:
    return input_ids.shape[-1] >= self.max_length







class 		UpperCAmelCase   (				lowercase_):


  """simple docstring"""







  def __init__(				self    :					Dict							,	UpperCamelCase__    :					float							,	UpperCamelCase__    :					Optional[float] = None  )     ->						Tuple:
    _UpperCamelCase       			=max_time
    _UpperCamelCase       			=time.time() if initial_timestamp is None else initial_timestamp




  @add_start_docstrings(UpperCamelCase__  )
  def __call__(				self    :					Optional[Any]							,	UpperCamelCase__    :					torch.LongTensor							,	UpperCamelCase__    :					torch.FloatTensor							,	**UpperCamelCase__    :					List[Any]  )     ->						bool:
    return time.time() - self.initial_timestamp > self.max_time







class 		UpperCAmelCase   (				lowercase_):


  """simple docstring"""







  @add_start_docstrings(UpperCamelCase__  )
  def __call__(				self    :					List[Any]							,	UpperCamelCase__    :					torch.LongTensor							,	UpperCamelCase__    :					torch.FloatTensor							,	**UpperCamelCase__    :					List[str]  )     ->						bool:
    return any(criteria(UpperCamelCase__							,	UpperCamelCase__  ) for criteria in self  )




  @property
  def   UpperCamelCase__      (				self    :					str  )     ->						Optional[int]:
    for stopping_criterium in self:
      if isinstance(UpperCamelCase__							,	UpperCamelCase__  ):
        return stopping_criterium.max_length
      elif isinstance(UpperCamelCase__							,	UpperCamelCase__  ):
        return stopping_criterium.max_length
    return None




def 					_a   (__SCREAMING_SNAKE_CASE  ,      __SCREAMING_SNAKE_CASE   ):


  """simple docstring"""

  _UpperCamelCase       			=stopping_criteria.max_length
  _UpperCamelCase       			=deepcopy(__SCREAMING_SNAKE_CASE   )
  if stopping_max_length is not None and stopping_max_length != max_length:
    warnings.warn('''You set different `max_length` for stopping criteria and `max_length` parameter'''  ,      __SCREAMING_SNAKE_CASE   )
  elif stopping_max_length is None:
    new_stopping_criteria.append(MaxLengthCriteria(max_length=__SCREAMING_SNAKE_CASE   )   )
  return new_stopping_criteria













'''simple docstring'''






import argparse
import datetime


def 					_a   (__SCREAMING_SNAKE_CASE   ):


  """simple docstring"""

  _UpperCamelCase       			={
      '''0''': '''Sunday''',
      '''1''': '''Monday''',
      '''2''': '''Tuesday''',
      '''3''': '''Wednesday''',
      '''4''': '''Thursday''',
      '''5''': '''Friday''',
      '''6''': '''Saturday''',
  }

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

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

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

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

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

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

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

  # Get datetime obj for validation
  _UpperCamelCase       			=datetime.date(int(__SCREAMING_SNAKE_CASE   )  ,      int(__SCREAMING_SNAKE_CASE   )  ,      int(__SCREAMING_SNAKE_CASE   )   )

  # Start math
  if m <= 2:
    _UpperCamelCase       			=y - 1
    _UpperCamelCase       			=m + 12
  # maths var
  _UpperCamelCase       			=int(str(__SCREAMING_SNAKE_CASE   )[:2]   )
  _UpperCamelCase       			=int(str(__SCREAMING_SNAKE_CASE   )[2:]   )
  _UpperCamelCase       			=int(2.6 * m - 5.3_9   )
  _UpperCamelCase       			=int(c / 4   )
  _UpperCamelCase       			=int(k / 4   )
  _UpperCamelCase       			=int(d + k   )
  _UpperCamelCase       			=int(t + u + v + x   )
  _UpperCamelCase       			=int(z - (2 * c)   )
  _UpperCamelCase       			=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
  _UpperCamelCase       			=f'''Your date {date_input}, is a {days[str(__SCREAMING_SNAKE_CASE   )]}!'''
  return response


if __name__ == "__main__":
      import doctest

      doctest.testmod()
      __lowerCamelCase						: List[Any]		=   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						: Union[str, Any]		=   parser.parse_args()
      zeller(args.date_input)






