





import os
import string
import sys


UpperCamelCase__											= 1 << 8

UpperCamelCase__											= {
    "tab": ord("\t"),
    "newline": ord("\r"),
    "esc": 27,
    "up": 65 + ARROW_KEY_FLAG,
    "down": 66 + ARROW_KEY_FLAG,
    "right": 67 + ARROW_KEY_FLAG,
    "left": 68 + ARROW_KEY_FLAG,
    "mod_int": 91,
    "undefined": sys.maxsize,
    "interrupt": 3,
    "insert": 50,
    "delete": 51,
    "pg_up": 53,
    "pg_down": 54,
}

UpperCamelCase__											= KEYMAP["up"]
UpperCamelCase__											= KEYMAP["left"]

if sys.platform == "win32":
					UpperCamelCase__											= []
					UpperCamelCase__											= {
					    B"\xe0H": KEYMAP["up"] - ARROW_KEY_FLAG,
					    B"\x00H": KEYMAP["up"] - ARROW_KEY_FLAG,
					    B"\xe0P": KEYMAP["down"] - ARROW_KEY_FLAG,
					    B"\x00P": KEYMAP["down"] - ARROW_KEY_FLAG,
					    B"\xe0M": KEYMAP["right"] - ARROW_KEY_FLAG,
					    B"\x00M": KEYMAP["right"] - ARROW_KEY_FLAG,
					    B"\xe0K": KEYMAP["left"] - ARROW_KEY_FLAG,
					    B"\x00K": KEYMAP["left"] - ARROW_KEY_FLAG,
					}

for i in range(10):
					UpperCamelCase__											= ord(str(i))





def     _UpperCamelCase     ():






							"""simple docstring"""





							if os.name == "nt":
														import msvcrt

														UpperCamelCase__				     =			"""mbcs"""
														# Flush the keyboard buffer
														while msvcrt.kbhit():
																					msvcrt.getch()
														if len(a__       ) == 0:
																					# Read the keystroke
																					UpperCamelCase__				     =			msvcrt.getch()

																					# If it is a prefix char, get second part
																					if ch in (b"\x00", b"\xe0"):
																												UpperCamelCase__				     =			ch + msvcrt.getch()
																												# Translate actual Win chars to bullet char types
																												try:
																																			UpperCamelCase__				     =			chr(WIN_KEYMAP[cha]       )
																																			WIN_CH_BUFFER.append(chr(KEYMAP["""mod_int"""]       )       )
																																			WIN_CH_BUFFER.append(a__       )
																																			if ord(a__       ) in (
																																			    KEYMAP["insert"] - 1 << 9,
																																			    KEYMAP["delete"] - 1 << 9,
																																			    KEYMAP["pg_up"] - 1 << 9,
																																			    KEYMAP["pg_down"] - 1 << 9,
																																			):
																																										WIN_CH_BUFFER.append(chr(126       )       )
																																			UpperCamelCase__				     =			chr(KEYMAP["""esc"""]       )
																												except KeyError:
																																			UpperCamelCase__				     =			cha[1]
																					else:
																												UpperCamelCase__				     =			ch.decode(a__       )
														else:
																					UpperCamelCase__				     =			WIN_CH_BUFFER.pop(0       )
							elif os.name == "posix":
														import termios
														import tty

														UpperCamelCase__				     =			sys.stdin.fileno()
														UpperCamelCase__				     =			termios.tcgetattr(a__       )
														try:
																					tty.setraw(a__       )
																					UpperCamelCase__				     =			sys.stdin.read(1       )
														finally:
																					termios.tcsetattr(a__   ,			termios.TCSADRAIN   ,			a__       )
							return ch





def     _UpperCamelCase     ():






							"""simple docstring"""





							UpperCamelCase__				     =			get_raw_chars()
							if ord(a__       ) in [KEYMAP["interrupt"], KEYMAP["newline"]]:
														return char

							elif ord(a__       ) == KEYMAP["esc"]:
														UpperCamelCase__				     =			get_raw_chars()
														if ord(a__       ) == KEYMAP["mod_int"]:
																					UpperCamelCase__				     =			get_raw_chars()
																					if ord(a__       ) >= KEYMAP["arrow_begin"] - ARROW_KEY_FLAG and ord(a__       ) <= KEYMAP["arrow_end"] - ARROW_KEY_FLAG:
																												return chr(ord(a__       ) + ARROW_KEY_FLAG       )
																					else:
																												return KEYMAP["undefined"]
														else:
																					return get_raw_chars()

							else:
														if char in string.printable:
																					return char
														else:
																					return KEYMAP["undefined"]











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






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

																												UpperCamelCase__				     =			FlaxAutoModel.from_pretrained(__lowerCAmelCase  )
																												self.assertIsNotNone(__lowerCAmelCase  )
																												self.assertIsInstance(__lowerCAmelCase  , __lowerCAmelCase  )






							@slow
							def 				_lowerCamelCase		(						self  ):
														for model_name in ["roberta-base", "roberta-large"]:
																					with self.subTest(__lowerCAmelCase  ):
																												UpperCamelCase__				     =			AutoConfig.from_pretrained(__lowerCAmelCase  )
																												self.assertIsNotNone(__lowerCAmelCase  )
																												self.assertIsInstance(__lowerCAmelCase  , __lowerCAmelCase  )

																												UpperCamelCase__				     =			FlaxAutoModel.from_pretrained(__lowerCAmelCase  )
																												self.assertIsNotNone(__lowerCAmelCase  )
																												self.assertIsInstance(__lowerCAmelCase  , __lowerCAmelCase  )






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

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

																					eval(**__lowerCAmelCase  ).block_until_ready()






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

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

																					eval(**__lowerCAmelCase  ).block_until_ready()






							def 				_lowerCamelCase		(						self  ):
														with self.assertRaisesRegex(
														    __lowerCAmelCase  , """bert-base is not a local folder and is not a valid model identifier"""  ):
																					UpperCamelCase__				     =			FlaxAutoModel.from_pretrained("""bert-base"""  )






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






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







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




