





'''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       __SCREAMING_SNAKE_CASE	(						unittest.TestCase			):



     '''simple docstring'''






     @slow
     def 	UpperCamelCase(					self	):
       # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
       for model_name in ["bert-base-uncased"]:
         _snake_case     		=				AutoConfig.from_pretrained(lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				TFAutoModel.from_pretrained(lowerCamelCase						,   from_pt=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				AutoModel.from_pretrained(lowerCamelCase						,   from_tf=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

     @slow
     def 	UpperCamelCase(					self	):
       # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
       for model_name in ["bert-base-uncased"]:
         _snake_case     		=				AutoConfig.from_pretrained(lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				TFAutoModelForPreTraining.from_pretrained(lowerCamelCase						,   from_pt=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				AutoModelForPreTraining.from_pretrained(lowerCamelCase						,   from_tf=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

     @slow
     def 	UpperCamelCase(					self	):
       for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
         _snake_case     		=				AutoConfig.from_pretrained(lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				TFAutoModelForCausalLM.from_pretrained(lowerCamelCase						,   from_pt=lowerCamelCase	)
         _snake_case		,		_snake_case     		=				TFAutoModelForCausalLM.from_pretrained(
             lowerCamelCase						,   output_loading_info=lowerCamelCase						,   from_pt=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				AutoModelForCausalLM.from_pretrained(lowerCamelCase						,   from_tf=lowerCamelCase	)
         _snake_case		,		_snake_case     		=				AutoModelForCausalLM.from_pretrained(
             lowerCamelCase						,   output_loading_info=lowerCamelCase						,   from_tf=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

     @slow
     def 	UpperCamelCase(					self	):
       for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
         _snake_case     		=				AutoConfig.from_pretrained(lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				TFAutoModelWithLMHead.from_pretrained(lowerCamelCase						,   from_pt=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				AutoModelWithLMHead.from_pretrained(lowerCamelCase						,   from_tf=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

     @slow
     def 	UpperCamelCase(					self	):
       for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
         _snake_case     		=				AutoConfig.from_pretrained(lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				TFAutoModelForMaskedLM.from_pretrained(lowerCamelCase						,   from_pt=lowerCamelCase	)
         _snake_case		,		_snake_case     		=				TFAutoModelForMaskedLM.from_pretrained(
             lowerCamelCase						,   output_loading_info=lowerCamelCase						,   from_pt=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				AutoModelForMaskedLM.from_pretrained(lowerCamelCase						,   from_tf=lowerCamelCase	)
         _snake_case		,		_snake_case     		=				AutoModelForMaskedLM.from_pretrained(
             lowerCamelCase						,   output_loading_info=lowerCamelCase						,   from_tf=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

     @slow
     def 	UpperCamelCase(					self	):
       for model_name in TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
         _snake_case     		=				AutoConfig.from_pretrained(lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				TFAutoModelForSeqaSeqLM.from_pretrained(lowerCamelCase						,   from_pt=lowerCamelCase	)
         _snake_case		,		_snake_case     		=				TFAutoModelForSeqaSeqLM.from_pretrained(
             lowerCamelCase						,   output_loading_info=lowerCamelCase						,   from_pt=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				AutoModelForSeqaSeqLM.from_pretrained(lowerCamelCase						,   from_tf=lowerCamelCase	)
         _snake_case		,		_snake_case     		=				AutoModelForSeqaSeqLM.from_pretrained(
             lowerCamelCase						,   output_loading_info=lowerCamelCase						,   from_tf=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

     @slow
     def 	UpperCamelCase(					self	):
       # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
       for model_name in ["bert-base-uncased"]:
         _snake_case     		=				AutoConfig.from_pretrained(lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				TFAutoModelForSequenceClassification.from_pretrained(lowerCamelCase						,   from_pt=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				AutoModelForSequenceClassification.from_pretrained(lowerCamelCase						,   from_tf=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

     @slow
     def 	UpperCamelCase(					self	):
       # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
       for model_name in ["bert-base-uncased"]:
         _snake_case     		=				AutoConfig.from_pretrained(lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				TFAutoModelForQuestionAnswering.from_pretrained(lowerCamelCase						,   from_pt=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

         _snake_case     		=				AutoModelForQuestionAnswering.from_pretrained(lowerCamelCase						,   from_tf=lowerCamelCase	)
         self.assertIsNotNone(lowerCamelCase	)
         self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)

     def 	UpperCamelCase(					self	):
       _snake_case     		=				TFAutoModelWithLMHead.from_pretrained(lowerCamelCase						,   from_pt=lowerCamelCase	)
       self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)
       self.assertEqual(model.num_parameters()						,   14_410	)
       self.assertEqual(model.num_parameters(only_trainable=lowerCamelCase	)						,   14_410	)

       _snake_case     		=				AutoModelWithLMHead.from_pretrained(lowerCamelCase						,   from_tf=lowerCamelCase	)
       self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)
       self.assertEqual(model.num_parameters()						,   14_410	)
       self.assertEqual(model.num_parameters(only_trainable=lowerCamelCase	)						,   14_410	)






     def 	UpperCamelCase(					self	):
       _snake_case     		=				TFAutoModelWithLMHead.from_pretrained(lowerCamelCase						,   from_pt=lowerCamelCase	)
       self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)
       self.assertEqual(model.num_parameters()						,   14_410	)
       self.assertEqual(model.num_parameters(only_trainable=lowerCamelCase	)						,   14_410	)

       _snake_case     		=				AutoModelWithLMHead.from_pretrained(lowerCamelCase						,   from_tf=lowerCamelCase	)
       self.assertIsInstance(lowerCamelCase						,   lowerCamelCase	)
       self.assertEqual(model.num_parameters()						,   14_410	)
       self.assertEqual(model.num_parameters(only_trainable=lowerCamelCase	)						,   14_410	)









'''simple docstring'''



from typing import TYPE_CHECKING

from ...file_utils import _LazyModule, is_torch_available
from ...utils import OptionalDependencyNotAvailable


__magic_name__   :						Any    =			{
    """configuration_gpt_neox_japanese""": ["""GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP""", """GPTNeoXJapaneseConfig"""],
    """tokenization_gpt_neox_japanese""": ["""GPTNeoXJapaneseTokenizer"""],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 __magic_name__   :						List[Any]    =			[
     """GPT_NEOX_JAPANESE_PRETRAINED_MODEL_ARCHIVE_LIST""",
     """GPTNeoXJapaneseForCausalLM""",
     """GPTNeoXJapaneseLayer""",
     """GPTNeoXJapaneseModel""",
     """GPTNeoXJapanesePreTrainedModel""",
 ]


if TYPE_CHECKING:
 from .configuration_gpt_neox_japanese import GPT_NEOX_JAPANESE_PRETRAINED_CONFIG_ARCHIVE_MAP, GPTNeoXJapaneseConfig
 from .tokenization_gpt_neox_japanese import GPTNeoXJapaneseTokenizer

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_gpt_neox_japanese import (
      GPT_NEOX_JAPANESE_PRETRAINED_MODEL_ARCHIVE_LIST,
      GPTNeoXJapaneseForCausalLM,
      GPTNeoXJapaneseLayer,
      GPTNeoXJapaneseModel,
      GPTNeoXJapanesePreTrainedModel,
  )


else:
 import sys

 __magic_name__   :						Union[str, Any]    =			_LazyModule(__name__, globals()["""__file__"""], _import_structure, module_spec=__spec__)


