



"""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       __UpperCamelCase     (							self      :	Any)						->       Optional[int]:




											"""simple docstring"""







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

																					_lowerCAmelCase:Dict									=  FlaxAutoModel.from_pretrained(a_)
																					self.assertIsNotNone(a_)
																					self.assertIsInstance(a_     ,a_)





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




											"""simple docstring"""







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

																					_lowerCAmelCase:Optional[int]									=  FlaxAutoModel.from_pretrained(a_)
																					self.assertIsNotNone(a_)
																					self.assertIsInstance(a_     ,a_)





						@slow
						def       __UpperCamelCase     (							self      :	Optional[Any])						->       Union[str, Any]:




											"""simple docstring"""







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

																@jax.jit
																def eval(**a__      :	str):
																					return model(**a_)

																eval(**a_).block_until_ready()





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




											"""simple docstring"""







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

																@jax.jit
																def eval(**a__      :	List[Any]):
																					return model(**a_)

																eval(**a_).block_until_ready()





						def       __UpperCamelCase     (							self      :	List[Any])						->       Optional[Any]:




											"""simple docstring"""







											with self.assertRaisesRegex(
											    a_     ,'''bert-base is not a local folder and is not a valid model identifier'''):
																_lowerCAmelCase:Union[str, Any]									=  FlaxAutoModel.from_pretrained('''bert-base''')





						def       __UpperCamelCase     (							self      :	int)						->       List[Any]:




											"""simple docstring"""







											with self.assertRaisesRegex(
											    a_     ,R'''aaaaaa is not a valid git identifier \(branch name, tag name or commit id\)'''):
																_lowerCAmelCase:List[Any]									=  FlaxAutoModel.from_pretrained(a_     ,revision='''aaaaaa''')





						def       __UpperCamelCase     (							self      :	Dict)						->       Optional[Any]:




											"""simple docstring"""







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







						def       __UpperCamelCase     (							self      :	List[str])						->       Tuple:




											"""simple docstring"""







											with self.assertRaisesRegex(a_     ,'''Use `from_pt=True` to load this model'''):
																_lowerCAmelCase:List[str]									=  FlaxAutoModel.from_pretrained('''hf-internal-testing/tiny-bert-pt-only''')












"""simple docstring"""






# NOTE: This file is deprecated and will be removed in a future version.
# It only exists so that temporarely `from diffusers.pipelines import DiffusionPipeline` works

from ...utils import deprecate
from ..controlnet.pipeline_flax_controlnet import FlaxStableDiffusionControlNetPipeline  # noqa: F401


deprecate(
    '''stable diffusion controlnet''',
    '''0.22.0''',
    '''Importing `FlaxStableDiffusionControlNetPipeline` from diffusers.pipelines.stable_diffusion.flax_pipeline_stable_diffusion_controlnet is deprecated. Please import `from diffusers import FlaxStableDiffusionControlNetPipeline` instead.''',
    standard_warn=False,
    stacklevel=3,
)






