"""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    a_   (  unittest.TestCase      ):




					def     _SCREAMING_SNAKE_CASE    (						self    :  Optional[int]	,    snake_case__    :  Any  ):
							for model_result in results.values():
									for batch_size, sequence_length in zip(model_result["""bs"""]	,    model_result["""ss"""]  ):
											lowerCAmelCase__   = model_result["""result"""][batch_size][sequence_length]
											self.assertIsNotNone(snake_case__  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  List[str]  ):
							lowerCAmelCase__   = """sshleifer/tiny-gpt2"""
							lowerCAmelCase__   = TensorFlowBenchmarkArguments(
							    models=[MODEL_ID]	,    training=snake_case__	,    inference=snake_case__	,    sequence_lengths=[8]	,    batch_sizes=[1]	,    eager_mode=snake_case__	,    multi_process=snake_case__	,    )
							lowerCAmelCase__   = TensorFlowBenchmark(snake_case__  )
							lowerCAmelCase__   = benchmark.run()
							self.check_results_dict_not_empty(results.time_inference_result  )
							self.check_results_dict_not_empty(results.memory_inference_result  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  List[Any]  ):
							lowerCAmelCase__   = """sgugger/tiny-distilbert-classification"""
							lowerCAmelCase__   = TensorFlowBenchmarkArguments(
							    models=[MODEL_ID]	,    training=snake_case__	,    inference=snake_case__	,    sequence_lengths=[8]	,    batch_sizes=[1]	,    multi_process=snake_case__	,    only_pretrain_model=snake_case__	,    )
							lowerCAmelCase__   = TensorFlowBenchmark(snake_case__  )
							lowerCAmelCase__   = benchmark.run()
							self.check_results_dict_not_empty(results.time_inference_result  )
							self.check_results_dict_not_empty(results.memory_inference_result  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  str  ):
							lowerCAmelCase__   = """sshleifer/tiny-gpt2"""
							lowerCAmelCase__   = TensorFlowBenchmarkArguments(
							    models=[MODEL_ID]	,    training=snake_case__	,    inference=snake_case__	,    sequence_lengths=[8]	,    batch_sizes=[1]	,    multi_process=snake_case__	,    )
							lowerCAmelCase__   = TensorFlowBenchmark(snake_case__  )
							lowerCAmelCase__   = benchmark.run()
							self.check_results_dict_not_empty(results.time_inference_result  )
							self.check_results_dict_not_empty(results.memory_inference_result  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  List[str]  ):
							lowerCAmelCase__   = """sshleifer/tiny-gpt2"""
							lowerCAmelCase__   = AutoConfig.from_pretrained(snake_case__  )
							lowerCAmelCase__   = TensorFlowBenchmarkArguments(
							    models=[MODEL_ID]	,    training=snake_case__	,    inference=snake_case__	,    sequence_lengths=[8]	,    batch_sizes=[1]	,    eager_mode=snake_case__	,    multi_process=snake_case__	,    )
							lowerCAmelCase__   = TensorFlowBenchmark(snake_case__	,    [config]  )
							lowerCAmelCase__   = benchmark.run()
							self.check_results_dict_not_empty(results.time_inference_result  )
							self.check_results_dict_not_empty(results.memory_inference_result  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  List[str]  ):
							lowerCAmelCase__   = """sshleifer/tiny-gpt2"""
							lowerCAmelCase__   = AutoConfig.from_pretrained(snake_case__  )
							lowerCAmelCase__   = TensorFlowBenchmarkArguments(
							    models=[MODEL_ID]	,    training=snake_case__	,    inference=snake_case__	,    sequence_lengths=[8]	,    batch_sizes=[1]	,    multi_process=snake_case__	,    )
							lowerCAmelCase__   = TensorFlowBenchmark(snake_case__	,    [config]  )
							lowerCAmelCase__   = benchmark.run()
							self.check_results_dict_not_empty(results.time_inference_result  )
							self.check_results_dict_not_empty(results.memory_inference_result  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  Dict  ):
							lowerCAmelCase__   = """sshleifer/tiny-gpt2"""
							lowerCAmelCase__   = TensorFlowBenchmarkArguments(
							    models=[MODEL_ID]	,    training=snake_case__	,    inference=snake_case__	,    sequence_lengths=[8]	,    batch_sizes=[1]	,    multi_process=snake_case__	,    )
							lowerCAmelCase__   = TensorFlowBenchmark(snake_case__  )
							lowerCAmelCase__   = benchmark.run()
							self.check_results_dict_not_empty(results.time_train_result  )
							self.check_results_dict_not_empty(results.memory_train_result  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  int  ):
							lowerCAmelCase__   = """sshleifer/tiny-gpt2"""
							lowerCAmelCase__   = AutoConfig.from_pretrained(snake_case__  )
							lowerCAmelCase__   = TensorFlowBenchmarkArguments(
							    models=[MODEL_ID]	,    training=snake_case__	,    inference=snake_case__	,    sequence_lengths=[8]	,    batch_sizes=[1]	,    multi_process=snake_case__	,    )
							lowerCAmelCase__   = TensorFlowBenchmark(snake_case__	,    [config]  )
							lowerCAmelCase__   = benchmark.run()
							self.check_results_dict_not_empty(results.time_train_result  )
							self.check_results_dict_not_empty(results.memory_train_result  )




					def     _SCREAMING_SNAKE_CASE    (						self    :  str  ):
							lowerCAmelCase__   = """patrickvonplaten/t5-tiny-random"""
							lowerCAmelCase__   = AutoConfig.from_pretrained(snake_case__  )
							lowerCAmelCase__   = TensorFlowBenchmarkArguments(
							    models=[MODEL_ID]	,    training=snake_case__	,    inference=snake_case__	,    sequence_lengths=[8]	,    batch_sizes=[1]	,    multi_process=snake_case__	,    )
							lowerCAmelCase__   = TensorFlowBenchmark(snake_case__	,    configs=[config]  )
							lowerCAmelCase__   = 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     _SCREAMING_SNAKE_CASE    (						self    :  Any  ):
							lowerCAmelCase__   = """sshleifer/tiny-gpt2"""
							lowerCAmelCase__   = TensorFlowBenchmarkArguments(
							    models=[MODEL_ID]	,    training=snake_case__	,    inference=snake_case__	,    sequence_lengths=[8]	,    batch_sizes=[1]	,    use_xla=snake_case__	,    multi_process=snake_case__	,    )
							lowerCAmelCase__   = TensorFlowBenchmark(snake_case__  )
							lowerCAmelCase__   = benchmark.run()
							self.check_results_dict_not_empty(results.time_inference_result  )
							self.check_results_dict_not_empty(results.memory_inference_result  )




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




					def     _SCREAMING_SNAKE_CASE    (						self    :  Dict  ):
							lowerCAmelCase__   = """sshleifer/tiny-gpt2"""

							def _check_summary_is_not_empty(snake_case__    :  Optional[int]  ):
									self.assertTrue(hasattr(snake_case__	,    """sequential"""  )  )
									self.assertTrue(hasattr(snake_case__	,    """cumulative"""  )  )
									self.assertTrue(hasattr(snake_case__	,    """current"""  )  )
									self.assertTrue(hasattr(snake_case__	,    """total"""  )  )

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





"""simple docstring"""




import math
from datetime import datetime, timedelta







def 				_UpperCAmelCase		(							lowerCamelCase__  ):





		"""simple docstring"""




		lowerCAmelCase__   = year % 19
		lowerCAmelCase__   = year % 4
		lowerCAmelCase__   = year % 7
		lowerCAmelCase__   = math.floor(year / 100  )
		lowerCAmelCase__   = math.floor((13 + 8 * leap_day_inhibits) / 25  )
		lowerCAmelCase__   = leap_day_inhibits / 4
		lowerCAmelCase__   = (
		    15 - lunar_orbit_correction + leap_day_inhibits - leap_day_reinstall_number
		) % 30
		lowerCAmelCase__   = (4 + leap_day_inhibits - leap_day_reinstall_number) % 7

		# days to be added to March 21
		lowerCAmelCase__   = (19 * metonic_cycle + secular_moon_shift) % 30

		# PHM -> Paschal Full Moon
		lowerCAmelCase__   = (
		    2 * julian_leap_year
		    + 4 * non_leap_year
		    + 6 * days_to_add
		    + century_starting_point
		) % 7

		if days_to_add == 29 and days_from_phm_to_sunday == 6:
				return datetime(lowerCamelCase__      ,	4      ,	19  )
		elif days_to_add == 28 and days_from_phm_to_sunday == 6:
				return datetime(lowerCamelCase__      ,	4      ,	18  )
		else:
				return datetime(lowerCamelCase__      ,	3      ,	22  ) + timedelta(
				    days=int(days_to_add + days_from_phm_to_sunday  )  )


if __name__ == "__main__":
			for year in (19_94, 20_00, 20_10, 20_21, 20_23):
						__lowerCAmelCase     :				List[str]    				=    "will be" if year > datetime.now().year else "was"
						print(F"Easter in {year} {tense} {gauss_easter(year)}")




