





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






		'''simple docstring'''






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






									"""simple docstring"""
									for model_name in ["bert-base-cased", "bert-large-uncased"]:
																with self.subTest(snake_case__  ):
																							lowercase_	:   Union[str, Any]  				=     AutoConfig.from_pretrained(snake_case__  )
																							self.assertIsNotNone(snake_case__  )
																							self.assertIsInstance(snake_case__,   snake_case__  )

																							lowercase_	:   List[Any]  				=     FlaxAutoModel.from_pretrained(snake_case__  )
																							self.assertIsNotNone(snake_case__  )
																							self.assertIsInstance(snake_case__,   snake_case__  )






		@slow
		def 						snake_case__				(							self  )       -> Dict:






									"""simple docstring"""
									for model_name in ["roberta-base", "roberta-large"]:
																with self.subTest(snake_case__  ):
																							lowercase_	:   Optional[Any]  				=     AutoConfig.from_pretrained(snake_case__  )
																							self.assertIsNotNone(snake_case__  )
																							self.assertIsInstance(snake_case__,   snake_case__  )

																							lowercase_	:   Optional[int]  				=     FlaxAutoModel.from_pretrained(snake_case__  )
																							self.assertIsNotNone(snake_case__  )
																							self.assertIsInstance(snake_case__,   snake_case__  )






		@slow
		def 						snake_case__				(							self  )       -> Tuple:






									"""simple docstring"""
									for model_name in ["bert-base-cased", "bert-large-uncased"]:
																lowercase_	:   Optional[Any]  				=     AutoTokenizer.from_pretrained(snake_case__  )
																lowercase_	:   Any  				=     FlaxBertModel.from_pretrained(snake_case__  )
																lowercase_	:   Union[str, Any]  				=     tokenizer("""Do you support jax jitted function?""",   return_tensors=TensorType.JAX  )

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

																eval(**snake_case__  ).block_until_ready()






		@slow
		def 						snake_case__				(							self  )       -> Optional[int]:






									"""simple docstring"""
									for model_name in ["roberta-base", "roberta-large"]:
																lowercase_	:   Optional[int]  				=     AutoTokenizer.from_pretrained(snake_case__  )
																lowercase_	:   Any  				=     FlaxRobertaModel.from_pretrained(snake_case__  )
																lowercase_	:   Dict  				=     tokenizer("""Do you support jax jitted function?""",   return_tensors=TensorType.JAX  )

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

																eval(**snake_case__  ).block_until_ready()






		def 						snake_case__				(							self  )       -> Any:






									"""simple docstring"""
									with self.assertRaisesRegex(
									    snake_case__,   """bert-base is not a local folder and is not a valid model identifier"""  ):
																lowercase_	:   Union[str, Any]  				=     FlaxAutoModel.from_pretrained("""bert-base"""  )






		def 						snake_case__				(							self  )       -> int:






									"""simple docstring"""
									with self.assertRaisesRegex(
									    snake_case__,   r"""aaaaaa is not a valid git identifier \(branch name, tag name or commit id\)"""  ):
																lowercase_	:   int  				=     FlaxAutoModel.from_pretrained(snake_case__,   revision="""aaaaaa"""  )






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






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






		def 						snake_case__				(							self  )       -> Tuple:






									"""simple docstring"""
									with self.assertRaisesRegex(snake_case__,   """Use `from_pt=True` to load this model"""  ):
																lowercase_	:   Tuple  				=     FlaxAutoModel.from_pretrained("""hf-internal-testing/tiny-bert-pt-only"""  )






UpperCAmelCase_							=				8.31_44_62  # Unit - J mol-1 K-1





def  __magic_name__  (				lowercase				,       lowercase				,       lowercase				)				-> float:

							"""simple docstring"""



							if moles < 0 or kelvin < 0 or volume < 0:
														raise ValueError("""Invalid inputs. Enter positive value."""				)
							return moles * kelvin * UNIVERSAL_GAS_CONSTANT / volume





def  __magic_name__  (				lowercase				,       lowercase				,       lowercase				)				-> float:

							"""simple docstring"""



							if moles < 0 or kelvin < 0 or pressure < 0:
														raise ValueError("""Invalid inputs. Enter positive value."""				)
							return moles * kelvin * UNIVERSAL_GAS_CONSTANT / pressure


if __name__ == "__main__":
							from doctest import testmod

							testmod()