


'''simple docstring'''
def       a_				(	UpperCamelCase_ ):
							return "".join(chr(ord(UpperCamelCase_ ) - 3_2 ) if "a" <= char <= "z" else char for char in word )


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

							testmod()









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

						"""simple docstring"""






						@slow
						def 				_UpperCAmelCase       (  self							:      Dict	):
													for model_name in ["bert-base-cased", "bert-large-uncased"]:
																				with self.subTest(lowerCAmelCase	):
																											A_			    =		AutoConfig.from_pretrained(lowerCAmelCase	)
																											self.assertIsNotNone(lowerCAmelCase	)
																											self.assertIsInstance(lowerCAmelCase ,  lowerCAmelCase	)

																											A_			    =		FlaxAutoModel.from_pretrained(lowerCAmelCase	)
																											self.assertIsNotNone(lowerCAmelCase	)
																											self.assertIsInstance(lowerCAmelCase ,  lowerCAmelCase	)






						@slow
						def 				_UpperCAmelCase       (  self							:      Union[str, Any]	):
													for model_name in ["roberta-base", "roberta-large"]:
																				with self.subTest(lowerCAmelCase	):
																											A_			    =		AutoConfig.from_pretrained(lowerCAmelCase	)
																											self.assertIsNotNone(lowerCAmelCase	)
																											self.assertIsInstance(lowerCAmelCase ,  lowerCAmelCase	)

																											A_			    =		FlaxAutoModel.from_pretrained(lowerCAmelCase	)
																											self.assertIsNotNone(lowerCAmelCase	)
																											self.assertIsInstance(lowerCAmelCase ,  lowerCAmelCase	)






						@slow
						def 				_UpperCAmelCase       (  self							:      List[Any]	):
													for model_name in ["bert-base-cased", "bert-large-uncased"]:
																				A_			    =		AutoTokenizer.from_pretrained(lowerCAmelCase	)
																				A_			    =		FlaxBertModel.from_pretrained(lowerCAmelCase	)
																				A_			    =		tokenizer("Do you support jax jitted function?" ,  return_tensors=TensorType.JAX	)

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

																				eval(**lowerCAmelCase	).block_until_ready()






						@slow
						def 				_UpperCAmelCase       (  self							:      str	):
													for model_name in ["roberta-base", "roberta-large"]:
																				A_			    =		AutoTokenizer.from_pretrained(lowerCAmelCase	)
																				A_			    =		FlaxRobertaModel.from_pretrained(lowerCAmelCase	)
																				A_			    =		tokenizer("Do you support jax jitted function?" ,  return_tensors=TensorType.JAX	)

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

																				eval(**lowerCAmelCase	).block_until_ready()






						def 				_UpperCAmelCase       (  self							:      List[Any]	):
													with self.assertRaisesRegex(
													    lowerCAmelCase ,  "bert-base is not a local folder and is not a valid model identifier"	):
																				A_			    =		FlaxAutoModel.from_pretrained("bert-base"	)






						def 				_UpperCAmelCase       (  self							:      Any	):
													with self.assertRaisesRegex(
													    lowerCAmelCase ,  r"aaaaaa is not a valid git identifier \(branch name, tag name or commit id\)"	):
																				A_			    =		FlaxAutoModel.from_pretrained(lowerCAmelCase ,  revision="aaaaaa"	)






						def 				_UpperCAmelCase       (  self							:      Dict	):
													with self.assertRaisesRegex(
													    lowerCAmelCase ,  "hf-internal-testing/config-no-model does not appear to have a file named flax_model.msgpack" ,  ):
																				A_			    =		FlaxAutoModel.from_pretrained("hf-internal-testing/config-no-model"	)






						def 				_UpperCAmelCase       (  self							:      Any	):
													with self.assertRaisesRegex(lowerCAmelCase ,  "Use `from_pt=True` to load this model"	):
																				A_			    =		FlaxAutoModel.from_pretrained("hf-internal-testing/tiny-bert-pt-only"	)





