


'''simple docstring'''

from ..utils import DummyObject, requires_backends
class   __lowerCAmelCase						(metaclass=__snake_case     ):





      '''simple docstring'''






      lowerCAmelCase__					:     Union[str, Any]  					=							["""flax"""]



      def __init__(self    :    Union[str, Any]   ,						*UpperCamelCase    :    List[Any]   ,						**UpperCamelCase    :    List[Any] ):

             '''simple docstring'''







             requires_backends(self   ,						['''flax'''] )



      @classmethod
      def       UpperCamelCase__		(cls    :    Optional[Any]   ,						*UpperCamelCase    :    Union[str, Any]   ,						**UpperCamelCase    :    Optional[Any] ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






      @classmethod
      def       UpperCamelCase__		(cls    :    List[Any]   ,						*UpperCamelCase    :    int   ,						**UpperCamelCase    :    str ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






class   __lowerCAmelCase						(metaclass=__snake_case     ):





      '''simple docstring'''






      lowerCAmelCase__					:     Tuple  					=							["""flax"""]



      def __init__(self    :    Dict   ,						*UpperCamelCase    :    List[Any]   ,						**UpperCamelCase    :    int ):

             '''simple docstring'''







             requires_backends(self   ,						['''flax'''] )



      @classmethod
      def       UpperCamelCase__		(cls    :    str   ,						*UpperCamelCase    :    Dict   ,						**UpperCamelCase    :    Union[str, Any] ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






      @classmethod
      def       UpperCamelCase__		(cls    :    str   ,						*UpperCamelCase    :    List[str]   ,						**UpperCamelCase    :    int ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






class   __lowerCAmelCase						(metaclass=__snake_case     ):





      '''simple docstring'''






      lowerCAmelCase__					:     List[str]  					=							["""flax"""]



      def __init__(self    :    str   ,						*UpperCamelCase    :    Dict   ,						**UpperCamelCase    :    List[str] ):

             '''simple docstring'''







             requires_backends(self   ,						['''flax'''] )



      @classmethod
      def       UpperCamelCase__		(cls    :    Tuple   ,						*UpperCamelCase    :    Union[str, Any]   ,						**UpperCamelCase    :    str ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






      @classmethod
      def       UpperCamelCase__		(cls    :    Optional[Any]   ,						*UpperCamelCase    :    List[Any]   ,						**UpperCamelCase    :    Union[str, Any] ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






class   __lowerCAmelCase						(metaclass=__snake_case     ):





      '''simple docstring'''






      lowerCAmelCase__					:     int  					=							["""flax"""]



      def __init__(self    :    Optional[Any]   ,						*UpperCamelCase    :    List[Any]   ,						**UpperCamelCase    :    Tuple ):

             '''simple docstring'''







             requires_backends(self   ,						['''flax'''] )



      @classmethod
      def       UpperCamelCase__		(cls    :    Optional[Any]   ,						*UpperCamelCase    :    Tuple   ,						**UpperCamelCase    :    Any ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






      @classmethod
      def       UpperCamelCase__		(cls    :    List[Any]   ,						*UpperCamelCase    :    List[Any]   ,						**UpperCamelCase    :    int ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






class   __lowerCAmelCase						(metaclass=__snake_case     ):





      '''simple docstring'''






      lowerCAmelCase__					:     Any  					=							["""flax"""]



      def __init__(self    :    Union[str, Any]   ,						*UpperCamelCase    :    str   ,						**UpperCamelCase    :    List[Any] ):

             '''simple docstring'''







             requires_backends(self   ,						['''flax'''] )



      @classmethod
      def       UpperCamelCase__		(cls    :    List[str]   ,						*UpperCamelCase    :    int   ,						**UpperCamelCase    :    Tuple ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






      @classmethod
      def       UpperCamelCase__		(cls    :    List[Any]   ,						*UpperCamelCase    :    Union[str, Any]   ,						**UpperCamelCase    :    List[Any] ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






class   __lowerCAmelCase						(metaclass=__snake_case     ):





      '''simple docstring'''






      lowerCAmelCase__					:     Tuple  					=							["""flax"""]



      def __init__(self    :    str   ,						*UpperCamelCase    :    int   ,						**UpperCamelCase    :    Union[str, Any] ):

             '''simple docstring'''







             requires_backends(self   ,						['''flax'''] )



      @classmethod
      def       UpperCamelCase__		(cls    :    Optional[int]   ,						*UpperCamelCase    :    Dict   ,						**UpperCamelCase    :    Any ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






      @classmethod
      def       UpperCamelCase__		(cls    :    str   ,						*UpperCamelCase    :    Optional[Any]   ,						**UpperCamelCase    :    Optional[int] ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






class   __lowerCAmelCase						(metaclass=__snake_case     ):





      '''simple docstring'''






      lowerCAmelCase__					:     int  					=							["""flax"""]



      def __init__(self    :    int   ,						*UpperCamelCase    :    Optional[Any]   ,						**UpperCamelCase    :    Optional[int] ):

             '''simple docstring'''







             requires_backends(self   ,						['''flax'''] )



      @classmethod
      def       UpperCamelCase__		(cls    :    Union[str, Any]   ,						*UpperCamelCase    :    Tuple   ,						**UpperCamelCase    :    Tuple ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






      @classmethod
      def       UpperCamelCase__		(cls    :    Optional[Any]   ,						*UpperCamelCase    :    str   ,						**UpperCamelCase    :    Tuple ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






class   __lowerCAmelCase						(metaclass=__snake_case     ):





      '''simple docstring'''






      lowerCAmelCase__					:     List[Any]  					=							["""flax"""]



      def __init__(self    :    List[str]   ,						*UpperCamelCase    :    int   ,						**UpperCamelCase    :    Dict ):

             '''simple docstring'''







             requires_backends(self   ,						['''flax'''] )



      @classmethod
      def       UpperCamelCase__		(cls    :    Any   ,						*UpperCamelCase    :    Dict   ,						**UpperCamelCase    :    Dict ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






      @classmethod
      def       UpperCamelCase__		(cls    :    List[str]   ,						*UpperCamelCase    :    int   ,						**UpperCamelCase    :    Optional[int] ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






class   __lowerCAmelCase						(metaclass=__snake_case     ):





      '''simple docstring'''






      lowerCAmelCase__					:     Tuple  					=							["""flax"""]



      def __init__(self    :    List[str]   ,						*UpperCamelCase    :    Dict   ,						**UpperCamelCase    :    Any ):

             '''simple docstring'''







             requires_backends(self   ,						['''flax'''] )



      @classmethod
      def       UpperCamelCase__		(cls    :    Any   ,						*UpperCamelCase    :    Any   ,						**UpperCamelCase    :    List[str] ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






      @classmethod
      def       UpperCamelCase__		(cls    :    Dict   ,						*UpperCamelCase    :    Tuple   ,						**UpperCamelCase    :    Union[str, Any] ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






class   __lowerCAmelCase						(metaclass=__snake_case     ):





      '''simple docstring'''






      lowerCAmelCase__					:     Optional[Any]  					=							["""flax"""]



      def __init__(self    :    List[Any]   ,						*UpperCamelCase    :    int   ,						**UpperCamelCase    :    List[str] ):

             '''simple docstring'''







             requires_backends(self   ,						['''flax'''] )



      @classmethod
      def       UpperCamelCase__		(cls    :    Any   ,						*UpperCamelCase    :    Union[str, Any]   ,						**UpperCamelCase    :    Tuple ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






      @classmethod
      def       UpperCamelCase__		(cls    :    int   ,						*UpperCamelCase    :    Optional[int]   ,						**UpperCamelCase    :    str ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






class   __lowerCAmelCase						(metaclass=__snake_case     ):





      '''simple docstring'''






      lowerCAmelCase__					:     Tuple  					=							["""flax"""]



      def __init__(self    :    Optional[Any]   ,						*UpperCamelCase    :    Union[str, Any]   ,						**UpperCamelCase    :    Dict ):

             '''simple docstring'''







             requires_backends(self   ,						['''flax'''] )



      @classmethod
      def       UpperCamelCase__		(cls    :    Any   ,						*UpperCamelCase    :    Optional[Any]   ,						**UpperCamelCase    :    Tuple ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






      @classmethod
      def       UpperCamelCase__		(cls    :    Any   ,						*UpperCamelCase    :    str   ,						**UpperCamelCase    :    Dict ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






class   __lowerCAmelCase						(metaclass=__snake_case     ):





      '''simple docstring'''






      lowerCAmelCase__					:     Union[str, Any]  					=							["""flax"""]



      def __init__(self    :    Dict   ,						*UpperCamelCase    :    List[str]   ,						**UpperCamelCase    :    Tuple ):

             '''simple docstring'''







             requires_backends(self   ,						['''flax'''] )



      @classmethod
      def       UpperCamelCase__		(cls    :    List[Any]   ,						*UpperCamelCase    :    Optional[Any]   ,						**UpperCamelCase    :    List[Any] ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






      @classmethod
      def       UpperCamelCase__		(cls    :    Optional[int]   ,						*UpperCamelCase    :    str   ,						**UpperCamelCase    :    Optional[int] ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






class   __lowerCAmelCase						(metaclass=__snake_case     ):





      '''simple docstring'''






      lowerCAmelCase__					:     int  					=							["""flax"""]



      def __init__(self    :    Dict   ,						*UpperCamelCase    :    Dict   ,						**UpperCamelCase    :    List[str] ):

             '''simple docstring'''







             requires_backends(self   ,						['''flax'''] )



      @classmethod
      def       UpperCamelCase__		(cls    :    List[Any]   ,						*UpperCamelCase    :    List[str]   ,						**UpperCamelCase    :    Any ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






      @classmethod
      def       UpperCamelCase__		(cls    :    List[str]   ,						*UpperCamelCase    :    Optional[int]   ,						**UpperCamelCase    :    Dict ):

             '''simple docstring'''







             requires_backends(cls   ,						['''flax'''] )






'''simple docstring'''




import unittest

from transformers import AutoConfig, AutoTokenizer, BertConfig, TensorType, is_flax_available
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, require_flax, slow


if is_flax_available():
      import jax

      from transformers.models.auto.modeling_flax_auto import FlaxAutoModel
      from transformers.models.bert.modeling_flax_bert import FlaxBertModel
      from transformers.models.roberta.modeling_flax_roberta import FlaxRobertaModel





@require_flax
class  A				(							unittest.TestCase						):





     @slow
     def 				__lowerCAmelCase							(							self	) ->				List[Any]:






         """simple docstring"""






         for model_name in ["bert-base-cased", "bert-large-uncased"]:
             with self.subTest(SCREAMING_SNAKE_CASE	):
                 A       :   int					=						AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE	)
                 self.assertIsNotNone(SCREAMING_SNAKE_CASE	)
                 self.assertIsInstance(SCREAMING_SNAKE_CASE						,			SCREAMING_SNAKE_CASE	)

                 A       :   List[str]					=						FlaxAutoModel.from_pretrained(SCREAMING_SNAKE_CASE	)
                 self.assertIsNotNone(SCREAMING_SNAKE_CASE	)
                 self.assertIsInstance(SCREAMING_SNAKE_CASE						,			SCREAMING_SNAKE_CASE	)





     @slow
     def 				__lowerCAmelCase							(							self	) ->				int:






         """simple docstring"""






         for model_name in ["roberta-base", "roberta-large"]:
             with self.subTest(SCREAMING_SNAKE_CASE	):
                 A       :   Any					=						AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE	)
                 self.assertIsNotNone(SCREAMING_SNAKE_CASE	)
                 self.assertIsInstance(SCREAMING_SNAKE_CASE						,			SCREAMING_SNAKE_CASE	)

                 A       :   Any					=						FlaxAutoModel.from_pretrained(SCREAMING_SNAKE_CASE	)
                 self.assertIsNotNone(SCREAMING_SNAKE_CASE	)
                 self.assertIsInstance(SCREAMING_SNAKE_CASE						,			SCREAMING_SNAKE_CASE	)





     @slow
     def 				__lowerCAmelCase							(							self	) ->				Any:






         """simple docstring"""






         for model_name in ["bert-base-cased", "bert-large-uncased"]:
             A       :   Optional[int]					=						AutoTokenizer.from_pretrained(SCREAMING_SNAKE_CASE	)
             A       :   List[str]					=						FlaxBertModel.from_pretrained(SCREAMING_SNAKE_CASE	)
             A       :   Optional[Any]					=						tokenizer('''Do you support jax jitted function?'''						,			return_tensors=TensorType.JAX	)

             @jax.jit
             def eval(**SCREAMING_SNAKE_CASE	):
                 return model(**SCREAMING_SNAKE_CASE	)

             eval(**SCREAMING_SNAKE_CASE	).block_until_ready()





     @slow
     def 				__lowerCAmelCase							(							self	) ->				List[str]:






         """simple docstring"""






         for model_name in ["roberta-base", "roberta-large"]:
             A       :   List[str]					=						AutoTokenizer.from_pretrained(SCREAMING_SNAKE_CASE	)
             A       :   Union[str, Any]					=						FlaxRobertaModel.from_pretrained(SCREAMING_SNAKE_CASE	)
             A       :   int					=						tokenizer('''Do you support jax jitted function?'''						,			return_tensors=TensorType.JAX	)

             @jax.jit
             def eval(**SCREAMING_SNAKE_CASE	):
                 return model(**SCREAMING_SNAKE_CASE	)

             eval(**SCREAMING_SNAKE_CASE	).block_until_ready()





     def 				__lowerCAmelCase							(							self	) ->				List[str]:






         """simple docstring"""






         with self.assertRaisesRegex(
             SCREAMING_SNAKE_CASE						,			'''bert-base is not a local folder and is not a valid model identifier'''	):
             A       :   List[Any]					=						FlaxAutoModel.from_pretrained('''bert-base'''	)





     def 				__lowerCAmelCase							(							self	) ->				Tuple:






         """simple docstring"""






         with self.assertRaisesRegex(
             SCREAMING_SNAKE_CASE						,			R'''aaaaaa is not a valid git identifier \(branch name, tag name or commit id\)'''	):
             A       :   Optional[int]					=						FlaxAutoModel.from_pretrained(SCREAMING_SNAKE_CASE						,			revision='''aaaaaa'''	)





     def 				__lowerCAmelCase							(							self	) ->				str:






         """simple docstring"""






         with self.assertRaisesRegex(
             SCREAMING_SNAKE_CASE						,			'''hf-internal-testing/config-no-model does not appear to have a file named flax_model.msgpack'''						,			):
             A       :   List[str]					=						FlaxAutoModel.from_pretrained('''hf-internal-testing/config-no-model'''	)





     def 				__lowerCAmelCase							(							self	) ->				Optional[Any]:






         """simple docstring"""






         with self.assertRaisesRegex(SCREAMING_SNAKE_CASE						,			'''Use `from_pt=True` to load this model'''	):
             A       :   Any					=						FlaxAutoModel.from_pretrained('''hf-internal-testing/tiny-bert-pt-only'''	)




