


'''simple docstring'''



from __future__ import annotations

import unittest

from transformers import is_tf_available, is_torch_available
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow


if is_tf_available():
	from transformers import (
	    AutoConfig,
	    BertConfig,
	    GPTaConfig,
	    TaConfig,
	    TFAutoModel,
	    TFAutoModelForCausalLM,
	    TFAutoModelForMaskedLM,
	    TFAutoModelForPreTraining,
	    TFAutoModelForQuestionAnswering,
	    TFAutoModelForSeqaSeqLM,
	    TFAutoModelForSequenceClassification,
	    TFAutoModelWithLMHead,
	    TFBertForMaskedLM,
	    TFBertForPreTraining,
	    TFBertForQuestionAnswering,
	    TFBertForSequenceClassification,
	    TFBertModel,
	    TFGPTaLMHeadModel,
	    TFRobertaForMaskedLM,
	    TFTaForConditionalGeneration,
	)
	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

if is_torch_available():
	from transformers import (
	    AutoModel,
	    AutoModelForCausalLM,
	    AutoModelForMaskedLM,
	    AutoModelForPreTraining,
	    AutoModelForQuestionAnswering,
	    AutoModelForSeqaSeqLM,
	    AutoModelForSequenceClassification,
	    AutoModelWithLMHead,
	    BertForMaskedLM,
	    BertForPreTraining,
	    BertForQuestionAnswering,
	    BertForSequenceClassification,
	    BertModel,
	    GPTaLMHeadModel,
	    RobertaForMaskedLM,
	    TaForConditionalGeneration,
	)





@is_pt_tf_cross_test
class 							__UpperCamelCase    (		unittest.TestCase ):




	@slow
	def 				__UpperCAmelCase							(       self							):

						'''simple docstring'''





						for model_name in ["bert-base-uncased"]:
											__a      :	Dict    =  AutoConfig.from_pretrained(__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	Tuple    =  TFAutoModel.from_pretrained(__a						,    from_pt=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	Any    =  AutoModel.from_pretrained(__a						,    from_tf=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)




	@slow
	def 				__UpperCAmelCase							(       self							):

						'''simple docstring'''





						for model_name in ["bert-base-uncased"]:
											__a      :	List[Any]    =  AutoConfig.from_pretrained(__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	Dict    =  TFAutoModelForPreTraining.from_pretrained(__a						,    from_pt=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	str    =  AutoModelForPreTraining.from_pretrained(__a						,    from_tf=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)




	@slow
	def 				__UpperCAmelCase							(       self							):

						'''simple docstring'''





						for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
											__a      :	int    =  AutoConfig.from_pretrained(__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	Optional[Any]    =  TFAutoModelForCausalLM.from_pretrained(__a						,    from_pt=__a							)
											__a   ,    __a      :	Optional[int]    =  TFAutoModelForCausalLM.from_pretrained(
											    __a						,    output_loading_info=__a						,    from_pt=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	Optional[int]    =  AutoModelForCausalLM.from_pretrained(__a						,    from_tf=__a							)
											__a   ,    __a      :	Any    =  AutoModelForCausalLM.from_pretrained(
											    __a						,    output_loading_info=__a						,    from_tf=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)




	@slow
	def 				__UpperCAmelCase							(       self							):

						'''simple docstring'''





						for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
											__a      :	Optional[Any]    =  AutoConfig.from_pretrained(__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	int    =  TFAutoModelWithLMHead.from_pretrained(__a						,    from_pt=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	str    =  AutoModelWithLMHead.from_pretrained(__a						,    from_tf=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)




	@slow
	def 				__UpperCAmelCase							(       self							):

						'''simple docstring'''





						for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
											__a      :	str    =  AutoConfig.from_pretrained(__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	str    =  TFAutoModelForMaskedLM.from_pretrained(__a						,    from_pt=__a							)
											__a   ,    __a      :	str    =  TFAutoModelForMaskedLM.from_pretrained(
											    __a						,    output_loading_info=__a						,    from_pt=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	Any    =  AutoModelForMaskedLM.from_pretrained(__a						,    from_tf=__a							)
											__a   ,    __a      :	Tuple    =  AutoModelForMaskedLM.from_pretrained(
											    __a						,    output_loading_info=__a						,    from_tf=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)




	@slow
	def 				__UpperCAmelCase							(       self							):

						'''simple docstring'''





						for model_name in TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
											__a      :	Tuple    =  AutoConfig.from_pretrained(__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	Tuple    =  TFAutoModelForSeqaSeqLM.from_pretrained(__a						,    from_pt=__a							)
											__a   ,    __a      :	Tuple    =  TFAutoModelForSeqaSeqLM.from_pretrained(
											    __a						,    output_loading_info=__a						,    from_pt=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	Tuple    =  AutoModelForSeqaSeqLM.from_pretrained(__a						,    from_tf=__a							)
											__a   ,    __a      :	int    =  AutoModelForSeqaSeqLM.from_pretrained(
											    __a						,    output_loading_info=__a						,    from_tf=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)




	@slow
	def 				__UpperCAmelCase							(       self							):

						'''simple docstring'''





						for model_name in ["bert-base-uncased"]:
											__a      :	Optional[Any]    =  AutoConfig.from_pretrained(__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	List[Any]    =  TFAutoModelForSequenceClassification.from_pretrained(__a						,    from_pt=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	Union[str, Any]    =  AutoModelForSequenceClassification.from_pretrained(__a						,    from_tf=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)




	@slow
	def 				__UpperCAmelCase							(       self							):

						'''simple docstring'''





						for model_name in ["bert-base-uncased"]:
											__a      :	List[Any]    =  AutoConfig.from_pretrained(__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	Any    =  TFAutoModelForQuestionAnswering.from_pretrained(__a						,    from_pt=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)

											__a      :	Tuple    =  AutoModelForQuestionAnswering.from_pretrained(__a						,    from_tf=__a							)
											self.assertIsNotNone(__a							)
											self.assertIsInstance(__a						,    __a							)




	def 				__UpperCAmelCase							(       self							):

						'''simple docstring'''





						__a      :	str    =  TFAutoModelWithLMHead.from_pretrained(__a						,    from_pt=__a							)
						self.assertIsInstance(__a						,    __a							)
						self.assertEqual(model.num_parameters()						,    1_4410							)
						self.assertEqual(model.num_parameters(only_trainable=__a							)						,    1_4410							)

						__a      :	Optional[Any]    =  AutoModelWithLMHead.from_pretrained(__a						,    from_tf=__a							)
						self.assertIsInstance(__a						,    __a							)
						self.assertEqual(model.num_parameters()						,    1_4410							)
						self.assertEqual(model.num_parameters(only_trainable=__a							)						,    1_4410							)





	def 				__UpperCAmelCase							(       self							):

						'''simple docstring'''





						__a      :	Union[str, Any]    =  TFAutoModelWithLMHead.from_pretrained(__a						,    from_pt=__a							)
						self.assertIsInstance(__a						,    __a							)
						self.assertEqual(model.num_parameters()						,    1_4410							)
						self.assertEqual(model.num_parameters(only_trainable=__a							)						,    1_4410							)

						__a      :	List[Any]    =  AutoModelWithLMHead.from_pretrained(__a						,    from_tf=__a							)
						self.assertIsInstance(__a						,    __a							)
						self.assertEqual(model.num_parameters()						,    1_4410							)
						self.assertEqual(model.num_parameters(only_trainable=__a							)						,    1_4410							)







'''simple docstring'''



def   lowerCamelCase							(_SCREAMING_SNAKE_CASE				:       int       ):
					return number & 1 == 0


if __name__ == "__main__":
	import doctest

	doctest.testmod()



