






from __future__ import annotations

import copy
import tempfile
import unittest

from transformers import CONFIG_MAPPING, AutoConfig, BertConfig, GPTaConfig, TaConfig, TapasConfig, is_tf_available
from transformers.testing_utils import (
    DUMMY_UNKNOWN_IDENTIFIER,
    SMALL_MODEL_IDENTIFIER,
    RequestCounter,
    require_tensorflow_probability,
    require_tf,
    slow,
)

from ..bert.test_modeling_bert import BertModelTester


if is_tf_available():
							from transformers import (
							    TFAutoModel,
							    TFAutoModelForCausalLM,
							    TFAutoModelForMaskedLM,
							    TFAutoModelForPreTraining,
							    TFAutoModelForQuestionAnswering,
							    TFAutoModelForSeqaSeqLM,
							    TFAutoModelForSequenceClassification,
							    TFAutoModelForTableQuestionAnswering,
							    TFAutoModelForTokenClassification,
							    TFAutoModelWithLMHead,
							    TFBertForMaskedLM,
							    TFBertForPreTraining,
							    TFBertForQuestionAnswering,
							    TFBertForSequenceClassification,
							    TFBertModel,
							    TFFunnelBaseModel,
							    TFFunnelModel,
							    TFGPTaLMHeadModel,
							    TFRobertaForMaskedLM,
							    TFTaForConditionalGeneration,
							    TFTapasForQuestionAnswering,
							)
							from transformers.models.auto.modeling_tf_auto import (
							    TF_MODEL_FOR_CAUSAL_LM_MAPPING,
							    TF_MODEL_FOR_MASKED_LM_MAPPING,
							    TF_MODEL_FOR_PRETRAINING_MAPPING,
							    TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING,
							    TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
							    TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING,
							    TF_MODEL_MAPPING,
							)
							from transformers.models.bert.modeling_tf_bert import TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST
							from transformers.models.gpta.modeling_tf_gpta import TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST
							from transformers.models.ta.modeling_tf_ta import TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST
							from transformers.models.tapas.modeling_tf_tapas import TF_TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST

class        lowerCAmelCase_				(      lowercase	):







				"""simple docstring"""




				_snake_case				:   str        =			"""new-model"""


if is_tf_available():

							class        lowerCAmelCase_				(      lowercase	):







											"""simple docstring"""




											_snake_case				:   Any        =			NewModelConfig

@require_tf
class        lowerCAmelCase_				(      unittest.TestCase	):







				"""simple docstring"""




				@slow
				def 				__a   ( self     :str     ):
					UpperCamelCase__ :Optional[Any]						=      """bert-base-cased"""
					UpperCamelCase__ :Any						=      AutoConfig.from_pretrained(lowerCamelCase__     )
					self.assertIsNotNone(lowerCamelCase__     )
					self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )

					UpperCamelCase__ :Tuple						=      TFAutoModel.from_pretrained(lowerCamelCase__     )
					self.assertIsNotNone(lowerCamelCase__     )
					self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )







				@slow
				def 				__a   ( self     :List[Any]     ):
					UpperCamelCase__ :Dict						=      """bert-base-cased"""
					UpperCamelCase__ :Union[str, Any]						=      AutoConfig.from_pretrained(lowerCamelCase__     )
					self.assertIsNotNone(lowerCamelCase__     )
					self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )

					UpperCamelCase__ :Optional[Any]						=      TFAutoModelForPreTraining.from_pretrained(lowerCamelCase__     )
					self.assertIsNotNone(lowerCamelCase__     )
					self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )







				@slow
				def 				__a   ( self     :List[Any]     ):
					for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
						UpperCamelCase__ :Any						=      AutoConfig.from_pretrained(lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )

						UpperCamelCase__ :Union[str, Any]						=      TFAutoModelForCausalLM.from_pretrained(lowerCamelCase__     )
						UpperCamelCase__				,		UpperCamelCase__ :str						=      TFAutoModelForCausalLM.from_pretrained(lowerCamelCase__  ,     output_loading_info=lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )







				@slow
				def 				__a   ( self     :Any     ):
					for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
						UpperCamelCase__ :int						=      AutoConfig.from_pretrained(lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )

						UpperCamelCase__ :List[Any]						=      TFAutoModelWithLMHead.from_pretrained(lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )







				@slow
				def 				__a   ( self     :Any     ):
					for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
						UpperCamelCase__ :List[Any]						=      AutoConfig.from_pretrained(lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )

						UpperCamelCase__ :Optional[Any]						=      TFAutoModelForMaskedLM.from_pretrained(lowerCamelCase__     )
						UpperCamelCase__				,		UpperCamelCase__ :Optional[Any]						=      TFAutoModelForMaskedLM.from_pretrained(lowerCamelCase__  ,     output_loading_info=lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )







				@slow
				def 				__a   ( self     :str     ):
					for model_name in TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
						UpperCamelCase__ :List[str]						=      AutoConfig.from_pretrained(lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )

						UpperCamelCase__ :Any						=      TFAutoModelForSeqaSeqLM.from_pretrained(lowerCamelCase__     )
						UpperCamelCase__				,		UpperCamelCase__ :List[Any]						=      TFAutoModelForSeqaSeqLM.from_pretrained(lowerCamelCase__  ,     output_loading_info=lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )







				@slow
				def 				__a   ( self     :Dict     ):
					# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
					for model_name in ["bert-base-uncased"]:
						UpperCamelCase__ :List[Any]						=      AutoConfig.from_pretrained(lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )

						UpperCamelCase__ :Optional[int]						=      TFAutoModelForSequenceClassification.from_pretrained(lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )







				@slow
				def 				__a   ( self     :str     ):
					# for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
					for model_name in ["bert-base-uncased"]:
						UpperCamelCase__ :Tuple						=      AutoConfig.from_pretrained(lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )

						UpperCamelCase__ :int						=      TFAutoModelForQuestionAnswering.from_pretrained(lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )







				@slow
				@require_tensorflow_probability
				def 				__a   ( self     :Optional[Any]     ):
					for model_name in TF_TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST[5:6]:
						UpperCamelCase__ :Dict						=      AutoConfig.from_pretrained(lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )

						UpperCamelCase__ :str						=      TFAutoModelForTableQuestionAnswering.from_pretrained(lowerCamelCase__     )
						UpperCamelCase__				,		UpperCamelCase__ :Union[str, Any]						=      TFAutoModelForTableQuestionAnswering.from_pretrained(
						    lowerCamelCase__  ,     output_loading_info=lowerCamelCase__     )
						self.assertIsNotNone(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )







				def 				__a   ( self     :int     ):
					UpperCamelCase__ :Dict						=      TFAutoModelWithLMHead.from_pretrained(lowerCamelCase__     )
					self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )
					self.assertEqual(model.num_parameters()  ,     1_44_10     )
					self.assertEqual(model.num_parameters(only_trainable=lowerCamelCase__     )  ,     1_44_10     )







				def 				__a   ( self     :str     ):
					UpperCamelCase__ :List[Any]						=      TFAutoModelWithLMHead.from_pretrained(lowerCamelCase__     )
					self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )
					self.assertEqual(model.num_parameters()  ,     1_44_10     )
					self.assertEqual(model.num_parameters(only_trainable=lowerCamelCase__     )  ,     1_44_10     )







				def 				__a   ( self     :Tuple     ):
					# For the auto model mapping, FunnelConfig has two models: FunnelModel and FunnelBaseModel
					UpperCamelCase__ :Optional[Any]						=      TFAutoModel.from_pretrained("""sgugger/funnel-random-tiny"""     )
					self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )

					UpperCamelCase__ :List[Any]						=      copy.deepcopy(model.config     )
					UpperCamelCase__ :int						=      ["""FunnelBaseModel"""]
					UpperCamelCase__ :Union[str, Any]						=      TFAutoModel.from_config(lowerCamelCase__     )
					self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )

					with tempfile.TemporaryDirectory() as tmp_dir:
						model.save_pretrained(lowerCamelCase__     )
						UpperCamelCase__ :List[str]						=      TFAutoModel.from_pretrained(lowerCamelCase__     )
						self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )







				def 				__a   ( self     :Optional[Any]     ):
					try:
						AutoConfig.register("""new-model"""  ,     lowerCamelCase__     )

						UpperCamelCase__ :List[Any]						=      [
						    TFAutoModel,
						    TFAutoModelForCausalLM,
						    TFAutoModelForMaskedLM,
						    TFAutoModelForPreTraining,
						    TFAutoModelForQuestionAnswering,
						    TFAutoModelForSequenceClassification,
						    TFAutoModelForTokenClassification,
						]

						for auto_class in auto_classes:
							with self.subTest(auto_class.__name__     ):
								# Wrong config class will raise an error
								with self.assertRaises(lowerCamelCase__     ):
									auto_class.register(lowerCamelCase__  ,     lowerCamelCase__     )
								auto_class.register(lowerCamelCase__  ,     lowerCamelCase__     )
								# Trying to register something existing in the Transformers library will raise an error
								with self.assertRaises(lowerCamelCase__     ):
									auto_class.register(lowerCamelCase__  ,     lowerCamelCase__     )

								# Now that the config is registered, it can be used as any other config with the auto-API
								UpperCamelCase__ :Dict						=      BertModelTester(self     ).get_config()
								UpperCamelCase__ :Optional[Any]						=      NewModelConfig(**tiny_config.to_dict()     )
								UpperCamelCase__ :Any						=      auto_class.from_config(lowerCamelCase__     )
								self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )

								with tempfile.TemporaryDirectory() as tmp_dir:
									model.save_pretrained(lowerCamelCase__     )
									UpperCamelCase__ :int						=      auto_class.from_pretrained(lowerCamelCase__     )
									self.assertIsInstance(lowerCamelCase__  ,     lowerCamelCase__     )

					finally:
						if "new-model" in CONFIG_MAPPING._extra_content:
							del CONFIG_MAPPING._extra_content["new-model"]
						for mapping in (
						    TF_MODEL_MAPPING,
						    TF_MODEL_FOR_PRETRAINING_MAPPING,
						    TF_MODEL_FOR_QUESTION_ANSWERING_MAPPING,
						    TF_MODEL_FOR_SEQUENCE_CLASSIFICATION_MAPPING,
						    TF_MODEL_FOR_TOKEN_CLASSIFICATION_MAPPING,
						    TF_MODEL_FOR_CAUSAL_LM_MAPPING,
						    TF_MODEL_FOR_MASKED_LM_MAPPING,
						):
							if NewModelConfig in mapping._extra_content:
								del mapping._extra_content[NewModelConfig]







				def 				__a   ( self     :List[str]     ):
					with self.assertRaisesRegex(
					    lowerCamelCase__  ,     """bert-base is not a local folder and is not a valid model identifier"""     ):
						UpperCamelCase__ :Optional[Any]						=      TFAutoModel.from_pretrained("""bert-base"""     )







				def 				__a   ( self     :int     ):
					with self.assertRaisesRegex(
					    lowerCamelCase__  ,     r"""aaaaaa is not a valid git identifier \(branch name, tag name or commit id\)"""     ):
						UpperCamelCase__ :Optional[int]						=      TFAutoModel.from_pretrained(lowerCamelCase__  ,     revision="""aaaaaa"""     )







				def 				__a   ( self     :Optional[int]     ):
					with self.assertRaisesRegex(
					    lowerCamelCase__  ,     """hf-internal-testing/config-no-model does not appear to have a file named pytorch_model.bin"""  ,     ):
						UpperCamelCase__ :List[str]						=      TFAutoModel.from_pretrained("""hf-internal-testing/config-no-model"""     )







				def 				__a   ( self     :Tuple     ):
					with self.assertRaisesRegex(lowerCamelCase__  ,     """Use `from_pt=True` to load this model"""     ):
						UpperCamelCase__ :Tuple						=      TFAutoModel.from_pretrained("""hf-internal-testing/tiny-bert-pt-only"""     )







				def 				__a   ( self     :Optional[int]     ):
					# Make sure we have cached the model.
					UpperCamelCase__ :Tuple						=      TFAutoModel.from_pretrained("""hf-internal-testing/tiny-random-bert"""     )
					with RequestCounter() as counter:
						UpperCamelCase__ :List[Any]						=      TFAutoModel.from_pretrained("""hf-internal-testing/tiny-random-bert"""     )
						self.assertEqual(counter.get_request_count  ,     0     )
						self.assertEqual(counter.head_request_count  ,     1     )
						self.assertEqual(counter.other_request_count  ,     0     )

					# With a sharded checkpoint
					UpperCamelCase__ :Optional[int]						=      TFAutoModel.from_pretrained("""ArthurZ/tiny-random-bert-sharded"""     )
					with RequestCounter() as counter:
						UpperCamelCase__ :Dict						=      TFAutoModel.from_pretrained("""ArthurZ/tiny-random-bert-sharded"""     )
						self.assertEqual(counter.get_request_count  ,     0     )
						self.assertEqual(counter.head_request_count  ,     1     )
						self.assertEqual(counter.other_request_count  ,     0     )




'''simple docstring'''





import sys

__a  			=						(
    "73167176531330624919225119674426574742355349194934"
    "96983520312774506326239578318016984801869478851843"
    "85861560789112949495459501737958331952853208805511"
    "12540698747158523863050715693290963295227443043557"
    "66896648950445244523161731856403098711121722383113"
    "62229893423380308135336276614282806444486645238749"
    "30358907296290491560440772390713810515859307960866"
    "70172427121883998797908792274921901699720888093776"
    "65727333001053367881220235421809751254540594752243"
    "52584907711670556013604839586446706324415722155397"
    "53697817977846174064955149290862569321978468622482"
    "83972241375657056057490261407972968652414535100474"
    "82166370484403199890008895243450658541227588666881"
    "16427171479924442928230863465674813919123162824586"
    "17866458359124566529476545682848912883142607690042"
    "24219022671055626321111109370544217506941658960408"
    "07198403850962455444362981230987879927244284909188"
    "84580156166097919133875499200524063689912560717606"
    "05886116467109405077541002256983155200055935729725"
    "71636269561882670428252483600823257530420752963450"
)





def 		__snake_case(							_lowerCAmelCase = N						)						->					int:
      snake_case__    :       Dict       		= -sys.maxsize - 1
      for i in range(len(_lowerCAmelCase						) - 12						):
            snake_case__    :       Any       		= 1
            for j in range(13						):
                  product *= int(n[i + j]						)
            if product > largest_product:
                  snake_case__    :       List[str]       		= product
      return largest_product


if __name__ == "__main__":
       print(F"{solution() = }")
