


'''simple docstring'''






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 	a__       (							a__						):





       '''simple docstring'''






       lowercase__    :     List[str]					=   "new-model"


if is_tf_available():




  class 	a__       (							a__						):





         '''simple docstring'''






         lowercase__    :     Any					=   NewModelConfig




@require_tf
class 	a__       (							unittest.TestCase						):





       '''simple docstring'''






       @slow
       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							str:
              lowerCAmelCase__      =			'''bert-base-cased'''
              lowerCAmelCase__      =			AutoConfig.from_pretrained(lowerCamelCase_     )
              self.assertIsNotNone(lowerCamelCase_     )
              self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )

              lowerCAmelCase__      =			TFAutoModel.from_pretrained(lowerCamelCase_     )
              self.assertIsNotNone(lowerCamelCase_     )
              self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )







       @slow
       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							str:
              lowerCAmelCase__      =			'''bert-base-cased'''
              lowerCAmelCase__      =			AutoConfig.from_pretrained(lowerCamelCase_     )
              self.assertIsNotNone(lowerCamelCase_     )
              self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )

              lowerCAmelCase__      =			TFAutoModelForPreTraining.from_pretrained(lowerCamelCase_     )
              self.assertIsNotNone(lowerCamelCase_     )
              self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )







       @slow
       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Optional[int]:
              for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                     lowerCAmelCase__      =			AutoConfig.from_pretrained(lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )

                     lowerCAmelCase__      =			TFAutoModelForCausalLM.from_pretrained(lowerCamelCase_     )
                     lowerCAmelCase__     ,      lowerCAmelCase__      =			TFAutoModelForCausalLM.from_pretrained(lowerCamelCase_      ,					output_loading_info=lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )







       @slow
       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							str:
              for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                     lowerCAmelCase__      =			AutoConfig.from_pretrained(lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )

                     lowerCAmelCase__      =			TFAutoModelWithLMHead.from_pretrained(lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )







       @slow
       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							str:
              for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                     lowerCAmelCase__      =			AutoConfig.from_pretrained(lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )

                     lowerCAmelCase__      =			TFAutoModelForMaskedLM.from_pretrained(lowerCamelCase_     )
                     lowerCAmelCase__     ,      lowerCAmelCase__      =			TFAutoModelForMaskedLM.from_pretrained(lowerCamelCase_      ,					output_loading_info=lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )







       @slow
       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Union[str, Any]:
              for model_name in TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                     lowerCAmelCase__      =			AutoConfig.from_pretrained(lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )

                     lowerCAmelCase__      =			TFAutoModelForSeqaSeqLM.from_pretrained(lowerCamelCase_     )
                     lowerCAmelCase__     ,      lowerCAmelCase__      =			TFAutoModelForSeqaSeqLM.from_pretrained(lowerCamelCase_      ,					output_loading_info=lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )







       @slow
       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							List[Any]:
              # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
              for model_name in ["bert-base-uncased"]:
                     lowerCAmelCase__      =			AutoConfig.from_pretrained(lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )

                     lowerCAmelCase__      =			TFAutoModelForSequenceClassification.from_pretrained(lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )







       @slow
       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							int:
              # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
              for model_name in ["bert-base-uncased"]:
                     lowerCAmelCase__      =			AutoConfig.from_pretrained(lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )

                     lowerCAmelCase__      =			TFAutoModelForQuestionAnswering.from_pretrained(lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )







       @slow
       @require_tensorflow_probability
       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							List[str]:
              for model_name in TF_TAPAS_PRETRAINED_MODEL_ARCHIVE_LIST[5:6]:
                     lowerCAmelCase__      =			AutoConfig.from_pretrained(lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )

                     lowerCAmelCase__      =			TFAutoModelForTableQuestionAnswering.from_pretrained(lowerCamelCase_     )
                     lowerCAmelCase__     ,      lowerCAmelCase__      =			TFAutoModelForTableQuestionAnswering.from_pretrained(
                         lowerCamelCase_      ,					output_loading_info=lowerCamelCase_     )
                     self.assertIsNotNone(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )







       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Tuple:
              lowerCAmelCase__      =			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 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Union[str, Any]:
              lowerCAmelCase__      =			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 						__SCREAMING_SNAKE_CASE							(	self     ) ->							List[Any]:
              # For the auto model mapping, FunnelConfig has two models: FunnelModel and FunnelBaseModel
              lowerCAmelCase__      =			TFAutoModel.from_pretrained('''sgugger/funnel-random-tiny'''     )
              self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )

              lowerCAmelCase__      =			copy.deepcopy(model.config     )
              lowerCAmelCase__      =			['''FunnelBaseModel''']
              lowerCAmelCase__      =			TFAutoModel.from_config(lowerCamelCase_     )
              self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )

              with tempfile.TemporaryDirectory() as tmp_dir:
                     model.save_pretrained(lowerCamelCase_     )
                     lowerCAmelCase__      =			TFAutoModel.from_pretrained(lowerCamelCase_     )
                     self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )







       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							List[Any]:
              try:
                     AutoConfig.register('''new-model'''      ,					lowerCamelCase_     )

                     lowerCAmelCase__      =			[
                         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
                                   lowerCAmelCase__      =			BertModelTester(self     ).get_config()
                                   lowerCAmelCase__      =			NewModelConfig(**tiny_config.to_dict()     )
                                   lowerCAmelCase__      =			auto_class.from_config(lowerCamelCase_     )
                                   self.assertIsInstance(lowerCamelCase_      ,					lowerCamelCase_     )

                                   with tempfile.TemporaryDirectory() as tmp_dir:
                                          model.save_pretrained(lowerCamelCase_     )
                                          lowerCAmelCase__      =			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 						__SCREAMING_SNAKE_CASE							(	self     ) ->							str:
              with self.assertRaisesRegex(
                  lowerCamelCase_      ,					'''bert-base is not a local folder and is not a valid model identifier'''     ):
                     lowerCAmelCase__      =			TFAutoModel.from_pretrained('''bert-base'''     )







       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Union[str, Any]:
              with self.assertRaisesRegex(
                  lowerCamelCase_      ,					r'''aaaaaa is not a valid git identifier \(branch name, tag name or commit id\)'''     ):
                     lowerCAmelCase__      =			TFAutoModel.from_pretrained(lowerCamelCase_      ,					revision='''aaaaaa'''     )







       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Union[str, Any]:
              with self.assertRaisesRegex(
                  lowerCamelCase_      ,					'''hf-internal-testing/config-no-model does not appear to have a file named pytorch_model.bin'''      ,					):
                     lowerCAmelCase__      =			TFAutoModel.from_pretrained('''hf-internal-testing/config-no-model'''     )







       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							List[str]:
              with self.assertRaisesRegex(lowerCamelCase_      ,					'''Use `from_pt=True` to load this model'''     ):
                     lowerCAmelCase__      =			TFAutoModel.from_pretrained('''hf-internal-testing/tiny-bert-pt-only'''     )







       def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							str:
              # Make sure we have cached the model.
              lowerCAmelCase__      =			TFAutoModel.from_pretrained('''hf-internal-testing/tiny-random-bert'''     )
              with RequestCounter() as counter:
                     lowerCAmelCase__      =			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
              lowerCAmelCase__      =			TFAutoModel.from_pretrained('''ArthurZ/tiny-random-bert-sharded'''     )
              with RequestCounter() as counter:
                     lowerCAmelCase__      =			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 tempfile
import unittest

import numpy as np
from huggingface_hub import HfFolder, delete_repo
from requests.exceptions import HTTPError

from transformers import BertConfig, is_flax_available
from transformers.testing_utils import TOKEN, USER, is_staging_test, require_flax


if is_flax_available():
		import os

		from flax.core.frozen_dict import unfreeze
		from flax.traverse_util import flatten_dict

		from transformers import FlaxBertModel

		__UpperCAmelCase					       =							'''0.12'''  # assumed parallelism: 8




@require_flax
@is_staging_test
class 	a__       (							unittest.TestCase						):





							'''simple docstring'''






							@classmethod
							def 						__SCREAMING_SNAKE_CASE							(	cls     ) ->							Any:
														lowerCAmelCase__      =			TOKEN
														HfFolder.save_token(lowerCamelCase_     )







							@classmethod
							def 						__SCREAMING_SNAKE_CASE							(	cls     ) ->							Tuple:
														try:
																					delete_repo(token=cls._token      ,					repo_id='''test-model-flax'''     )
														except HTTPError:
																					pass

														try:
																					delete_repo(token=cls._token      ,					repo_id='''valid_org/test-model-flax-org'''     )
														except HTTPError:
																					pass







							def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							List[Any]:
														lowerCAmelCase__      =			BertConfig(
														    vocab_size=99      ,					hidden_size=32      ,					num_hidden_layers=5      ,					num_attention_heads=4      ,					intermediate_size=37     )
														lowerCAmelCase__      =			FlaxBertModel(lowerCamelCase_     )
														model.push_to_hub('''test-model-flax'''      ,					use_auth_token=self._token     )

														lowerCAmelCase__      =			FlaxBertModel.from_pretrained(F"""{USER}/test-model-flax"""     )

														lowerCAmelCase__      =			flatten_dict(unfreeze(model.params     )     )
														lowerCAmelCase__      =			flatten_dict(unfreeze(new_model.params     )     )

														for key in base_params.keys():
																					lowerCAmelCase__      =			(base_params[key] - new_params[key]).sum().item()
																					self.assertLessEqual(lowerCamelCase_      ,					1e-3      ,					msg=F"""{key} not identical"""     )

														# Reset repo
														delete_repo(token=self._token      ,					repo_id='''test-model-flax'''     )

														# Push to hub via save_pretrained
														with tempfile.TemporaryDirectory() as tmp_dir:
																					model.save_pretrained(lowerCamelCase_      ,					repo_id='''test-model-flax'''      ,					push_to_hub=lowerCamelCase_      ,					use_auth_token=self._token     )

														lowerCAmelCase__      =			FlaxBertModel.from_pretrained(F"""{USER}/test-model-flax"""     )

														lowerCAmelCase__      =			flatten_dict(unfreeze(model.params     )     )
														lowerCAmelCase__      =			flatten_dict(unfreeze(new_model.params     )     )

														for key in base_params.keys():
																					lowerCAmelCase__      =			(base_params[key] - new_params[key]).sum().item()
																					self.assertLessEqual(lowerCamelCase_      ,					1e-3      ,					msg=F"""{key} not identical"""     )







							def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Union[str, Any]:
														lowerCAmelCase__      =			BertConfig(
														    vocab_size=99      ,					hidden_size=32      ,					num_hidden_layers=5      ,					num_attention_heads=4      ,					intermediate_size=37     )
														lowerCAmelCase__      =			FlaxBertModel(lowerCamelCase_     )
														model.push_to_hub('''valid_org/test-model-flax-org'''      ,					use_auth_token=self._token     )

														lowerCAmelCase__      =			FlaxBertModel.from_pretrained('''valid_org/test-model-flax-org'''     )

														lowerCAmelCase__      =			flatten_dict(unfreeze(model.params     )     )
														lowerCAmelCase__      =			flatten_dict(unfreeze(new_model.params     )     )

														for key in base_params.keys():
																					lowerCAmelCase__      =			(base_params[key] - new_params[key]).sum().item()
																					self.assertLessEqual(lowerCamelCase_      ,					1e-3      ,					msg=F"""{key} not identical"""     )

														# Reset repo
														delete_repo(token=self._token      ,					repo_id='''valid_org/test-model-flax-org'''     )

														# Push to hub via save_pretrained
														with tempfile.TemporaryDirectory() as tmp_dir:
																					model.save_pretrained(
																					    lowerCamelCase_      ,					repo_id='''valid_org/test-model-flax-org'''      ,					push_to_hub=lowerCamelCase_      ,					use_auth_token=self._token     )

														lowerCAmelCase__      =			FlaxBertModel.from_pretrained('''valid_org/test-model-flax-org'''     )

														lowerCAmelCase__      =			flatten_dict(unfreeze(model.params     )     )
														lowerCAmelCase__      =			flatten_dict(unfreeze(new_model.params     )     )

														for key in base_params.keys():
																					lowerCAmelCase__      =			(base_params[key] - new_params[key]).sum().item()
																					self.assertLessEqual(lowerCamelCase_      ,					1e-3      ,					msg=F"""{key} not identical"""     )


def       _snake_case     (  A				,					A )		->					Optional[int]:
							lowerCAmelCase__      =			True
							lowerCAmelCase__      =			flatten_dict(modela.params )
							lowerCAmelCase__      =			flatten_dict(modela.params )
							for key in flat_params_a.keys():
														if np.sum(np.abs(flat_params_a[key] - flat_params_a[key] ) ) > 1E-4:
																					lowerCAmelCase__      =			False

							return models_are_equal






@require_flax
class 	a__       (							unittest.TestCase						):





							'''simple docstring'''






							def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Optional[Any]:
														lowerCAmelCase__      =			BertConfig.from_pretrained('''hf-internal-testing/tiny-bert-flax-only'''     )
														lowerCAmelCase__      =			FlaxBertModel(lowerCamelCase_     )

														lowerCAmelCase__      =			'''bert'''
														with tempfile.TemporaryDirectory() as tmp_dir:
																					model.save_pretrained(os.path.join(lowerCamelCase_      ,					lowerCamelCase_     )     )

																					with self.assertRaises(lowerCamelCase_     ):
																												lowerCAmelCase__      =			FlaxBertModel.from_pretrained(lowerCamelCase_     )

																					lowerCAmelCase__      =			FlaxBertModel.from_pretrained(lowerCamelCase_      ,					subfolder=lowerCamelCase_     )

														self.assertTrue(check_models_equal(lowerCamelCase_      ,					lowerCamelCase_     )     )







							def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							List[Any]:
														lowerCAmelCase__      =			BertConfig.from_pretrained('''hf-internal-testing/tiny-bert-flax-only'''     )
														lowerCAmelCase__      =			FlaxBertModel(lowerCamelCase_     )

														lowerCAmelCase__      =			'''bert'''
														with tempfile.TemporaryDirectory() as tmp_dir:
																					model.save_pretrained(os.path.join(lowerCamelCase_      ,					lowerCamelCase_     )      ,					max_shard_size='''10KB'''     )

																					with self.assertRaises(lowerCamelCase_     ):
																												lowerCAmelCase__      =			FlaxBertModel.from_pretrained(lowerCamelCase_     )

																					lowerCAmelCase__      =			FlaxBertModel.from_pretrained(lowerCamelCase_      ,					subfolder=lowerCamelCase_     )

														self.assertTrue(check_models_equal(lowerCamelCase_      ,					lowerCamelCase_     )     )







							def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							Optional[Any]:
														lowerCAmelCase__      =			'''bert'''
														lowerCAmelCase__      =			'''hf-internal-testing/tiny-random-bert-subfolder'''

														with self.assertRaises(lowerCamelCase_     ):
																					lowerCAmelCase__      =			FlaxBertModel.from_pretrained(lowerCamelCase_     )

														lowerCAmelCase__      =			FlaxBertModel.from_pretrained(lowerCamelCase_      ,					subfolder=lowerCamelCase_     )

														self.assertIsNotNone(lowerCamelCase_     )







							def 						__SCREAMING_SNAKE_CASE							(	self     ) ->							List[Any]:
														lowerCAmelCase__      =			'''bert'''
														lowerCAmelCase__      =			'''hf-internal-testing/tiny-random-bert-sharded-subfolder'''
														with self.assertRaises(lowerCamelCase_     ):
																					lowerCAmelCase__      =			FlaxBertModel.from_pretrained(lowerCamelCase_     )

														lowerCAmelCase__      =			FlaxBertModel.from_pretrained(lowerCamelCase_      ,					subfolder=lowerCamelCase_     )

														self.assertIsNotNone(lowerCamelCase_     )