'''simple docstring'''

import os
import tempfile
import unittest
from pathlib import Path

from transformers import AutoConfig, is_tf_available
from transformers.testing_utils import require_tf


if is_tf_available():
  import tensorflow as tf

  from transformers import TensorFlowBenchmark, TensorFlowBenchmarkArguments



@require_tf
class      UpperCAmelCase    (		unittest.TestCase   ):





       '''simple docstring'''



       def _lowerCAmelCase(		self      ,  __lowerCAmelCase					)    ->    Union[str, Any]:



        for model_result in results.values():
         for batch_size, sequence_length in zip(model_result['''bs''']      ,  model_result['''ss''']					):
          lowercase__							:       List[Any]										=   model_result['''result'''][batch_size][sequence_length]
          self.assertIsNotNone(__A					)

       def _lowerCAmelCase(		self					)    ->    Tuple:
        lowercase__							:       Dict										=   '''sshleifer/tiny-gpt2'''
        lowercase__							:       Optional[int]										=   TensorFlowBenchmarkArguments(
            models=[MODEL_ID]      ,  training=__A      ,  inference=__A      ,  sequence_lengths=[8]      ,  batch_sizes=[1]      ,  eager_mode=__A      ,  multi_process=__A      ,  )
        lowercase__							:       str										=   TensorFlowBenchmark(__A					)
        lowercase__							:       Optional[int]										=   benchmark.run()
        self.check_results_dict_not_empty(results.time_inference_result					)
        self.check_results_dict_not_empty(results.memory_inference_result					)

       def _lowerCAmelCase(		self					)    ->    Union[str, Any]:
        lowercase__							:       Any										=   '''sgugger/tiny-distilbert-classification'''
        lowercase__							:       Any										=   TensorFlowBenchmarkArguments(
            models=[MODEL_ID]      ,  training=__A      ,  inference=__A      ,  sequence_lengths=[8]      ,  batch_sizes=[1]      ,  multi_process=__A      ,  only_pretrain_model=__A      ,  )
        lowercase__							:       str										=   TensorFlowBenchmark(__A					)
        lowercase__							:       Any										=   benchmark.run()
        self.check_results_dict_not_empty(results.time_inference_result					)
        self.check_results_dict_not_empty(results.memory_inference_result					)

       def _lowerCAmelCase(		self					)    ->    List[str]:
        lowercase__							:       int										=   '''sshleifer/tiny-gpt2'''
        lowercase__							:       List[str]										=   TensorFlowBenchmarkArguments(
            models=[MODEL_ID]      ,  training=__A      ,  inference=__A      ,  sequence_lengths=[8]      ,  batch_sizes=[1]      ,  multi_process=__A      ,  )
        lowercase__							:       Dict										=   TensorFlowBenchmark(__A					)
        lowercase__							:       List[str]										=   benchmark.run()
        self.check_results_dict_not_empty(results.time_inference_result					)
        self.check_results_dict_not_empty(results.memory_inference_result					)

       def _lowerCAmelCase(		self					)    ->    Optional[Any]:
        lowercase__							:       str										=   '''sshleifer/tiny-gpt2'''
        lowercase__							:       Optional[Any]										=   AutoConfig.from_pretrained(__A					)
        lowercase__							:       str										=   TensorFlowBenchmarkArguments(
            models=[MODEL_ID]      ,  training=__A      ,  inference=__A      ,  sequence_lengths=[8]      ,  batch_sizes=[1]      ,  eager_mode=__A      ,  multi_process=__A      ,  )
        lowercase__							:       List[str]										=   TensorFlowBenchmark(__A      ,  [config]					)
        lowercase__							:       Any										=   benchmark.run()
        self.check_results_dict_not_empty(results.time_inference_result					)
        self.check_results_dict_not_empty(results.memory_inference_result					)

       def _lowerCAmelCase(		self					)    ->    List[str]:
        lowercase__							:       Union[str, Any]										=   '''sshleifer/tiny-gpt2'''
        lowercase__							:       Tuple										=   AutoConfig.from_pretrained(__A					)
        lowercase__							:       Optional[int]										=   TensorFlowBenchmarkArguments(
            models=[MODEL_ID]      ,  training=__A      ,  inference=__A      ,  sequence_lengths=[8]      ,  batch_sizes=[1]      ,  multi_process=__A      ,  )
        lowercase__							:       Dict										=   TensorFlowBenchmark(__A      ,  [config]					)
        lowercase__							:       Any										=   benchmark.run()
        self.check_results_dict_not_empty(results.time_inference_result					)
        self.check_results_dict_not_empty(results.memory_inference_result					)

       def _lowerCAmelCase(		self					)    ->    Optional[Any]:
        lowercase__							:       Dict										=   '''sshleifer/tiny-gpt2'''
        lowercase__							:       Optional[int]										=   TensorFlowBenchmarkArguments(
            models=[MODEL_ID]      ,  training=__A      ,  inference=__A      ,  sequence_lengths=[8]      ,  batch_sizes=[1]      ,  multi_process=__A      ,  )
        lowercase__							:       List[Any]										=   TensorFlowBenchmark(__A					)
        lowercase__							:       Union[str, Any]										=   benchmark.run()
        self.check_results_dict_not_empty(results.time_train_result					)
        self.check_results_dict_not_empty(results.memory_train_result					)

       def _lowerCAmelCase(		self					)    ->    Union[str, Any]:
        lowercase__							:       Dict										=   '''sshleifer/tiny-gpt2'''
        lowercase__							:       str										=   AutoConfig.from_pretrained(__A					)
        lowercase__							:       int										=   TensorFlowBenchmarkArguments(
            models=[MODEL_ID]      ,  training=__A      ,  inference=__A      ,  sequence_lengths=[8]      ,  batch_sizes=[1]      ,  multi_process=__A      ,  )
        lowercase__							:       Union[str, Any]										=   TensorFlowBenchmark(__A      ,  [config]					)
        lowercase__							:       List[str]										=   benchmark.run()
        self.check_results_dict_not_empty(results.time_train_result					)
        self.check_results_dict_not_empty(results.memory_train_result					)

       def _lowerCAmelCase(		self					)    ->    Tuple:
        lowercase__							:       Union[str, Any]										=   '''patrickvonplaten/t5-tiny-random'''
        lowercase__							:       List[Any]										=   AutoConfig.from_pretrained(__A					)
        lowercase__							:       Optional[int]										=   TensorFlowBenchmarkArguments(
            models=[MODEL_ID]      ,  training=__A      ,  inference=__A      ,  sequence_lengths=[8]      ,  batch_sizes=[1]      ,  multi_process=__A      ,  )
        lowercase__							:       Optional[Any]										=   TensorFlowBenchmark(__A      ,  configs=[config]					)
        lowercase__							:       List[str]										=   benchmark.run()
        self.check_results_dict_not_empty(results.time_inference_result					)
        self.check_results_dict_not_empty(results.memory_inference_result					)

       @unittest.skipIf(is_tf_available() and len(tf.config.list_physical_devices('''GPU'''					)					) == 0      ,  '''Cannot do xla on CPU.'''					)
       def _lowerCAmelCase(		self					)    ->    List[str]:
        lowercase__							:       int										=   '''sshleifer/tiny-gpt2'''
        lowercase__							:       Optional[int]										=   TensorFlowBenchmarkArguments(
            models=[MODEL_ID]      ,  training=__A      ,  inference=__A      ,  sequence_lengths=[8]      ,  batch_sizes=[1]      ,  use_xla=__A      ,  multi_process=__A      ,  )
        lowercase__							:       List[Any]										=   TensorFlowBenchmark(__A					)
        lowercase__							:       Optional[int]										=   benchmark.run()
        self.check_results_dict_not_empty(results.time_inference_result					)
        self.check_results_dict_not_empty(results.memory_inference_result					)

       def _lowerCAmelCase(		self					)    ->    Any:
        lowercase__							:       Dict										=   '''sshleifer/tiny-gpt2'''
        with tempfile.TemporaryDirectory() as tmp_dir:
         lowercase__							:       Dict										=   TensorFlowBenchmarkArguments(
             models=[MODEL_ID]      ,  inference=__A      ,  save_to_csv=__A      ,  sequence_lengths=[8]      ,  batch_sizes=[1]      ,  inference_time_csv_file=os.path.join(__A      ,  '''inf_time.csv'''					)      ,  inference_memory_csv_file=os.path.join(__A      ,  '''inf_mem.csv'''					)      ,  env_info_csv_file=os.path.join(__A      ,  '''env.csv'''					)      ,  multi_process=__A      ,  )
         lowercase__							:       List[str]										=   TensorFlowBenchmark(__A					)
         benchmark.run()
         self.assertTrue(Path(os.path.join(__A      ,  '''inf_time.csv'''					)					).exists()					)
         self.assertTrue(Path(os.path.join(__A      ,  '''inf_mem.csv'''					)					).exists()					)
         self.assertTrue(Path(os.path.join(__A      ,  '''env.csv'''					)					).exists()					)


       def _lowerCAmelCase(		self					)    ->    Any:
        lowercase__							:       Optional[int]										=   '''sshleifer/tiny-gpt2'''

        def _check_summary_is_not_empty(__lowerCAmelCase					):
         self.assertTrue(hasattr(__A      ,  '''sequential'''					)					)
         self.assertTrue(hasattr(__A      ,  '''cumulative'''					)					)
         self.assertTrue(hasattr(__A      ,  '''current'''					)					)
         self.assertTrue(hasattr(__A      ,  '''total'''					)					)

        with tempfile.TemporaryDirectory() as tmp_dir:
         lowercase__							:       int										=   TensorFlowBenchmarkArguments(
             models=[MODEL_ID]      ,  inference=__A      ,  sequence_lengths=[8]      ,  batch_sizes=[1]      ,  log_filename=os.path.join(__A      ,  '''log.txt'''					)      ,  log_print=__A      ,  trace_memory_line_by_line=__A      ,  eager_mode=__A      ,  multi_process=__A      ,  )
         lowercase__							:       Optional[Any]										=   TensorFlowBenchmark(__A					)
         lowercase__							:       Any										=   benchmark.run()
         _check_summary_is_not_empty(result.inference_summary					)
         self.assertTrue(Path(os.path.join(__A      ,  '''log.txt'''					)					).exists()					)








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)