





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


    '''simple docstring'''







    @slow
    def  lowercase_					(       self     ):





        '''simple docstring'''

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

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



    @slow
    def  lowercase_					(       self     ):





        '''simple docstring'''

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

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



    @slow
    def  lowercase_					(       self     ):





        '''simple docstring'''

        for model_name in ["bert-base-cased", "bert-large-uncased"]:
            SCREAMING_SNAKE_CASE__											=			AutoTokenizer.from_pretrained(A_     )
            SCREAMING_SNAKE_CASE__											=			FlaxBertModel.from_pretrained(A_     )
            SCREAMING_SNAKE_CASE__											=			tokenizer('''Do you support jax jitted function?'''   ,				return_tensors=TensorType.JAX     )

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

            eval(**A_     ).block_until_ready()



    @slow
    def  lowercase_					(       self     ):





        '''simple docstring'''

        for model_name in ["roberta-base", "roberta-large"]:
            SCREAMING_SNAKE_CASE__											=			AutoTokenizer.from_pretrained(A_     )
            SCREAMING_SNAKE_CASE__											=			FlaxRobertaModel.from_pretrained(A_     )
            SCREAMING_SNAKE_CASE__											=			tokenizer('''Do you support jax jitted function?'''   ,				return_tensors=TensorType.JAX     )

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

            eval(**A_     ).block_until_ready()



    def  lowercase_					(       self     ):





        '''simple docstring'''

        with self.assertRaisesRegex(
            A_   ,				'''bert-base is not a local folder and is not a valid model identifier'''     ):
            SCREAMING_SNAKE_CASE__											=			FlaxAutoModel.from_pretrained('''bert-base'''     )



    def  lowercase_					(       self     ):





        '''simple docstring'''

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



    def  lowercase_					(       self     ):





        '''simple docstring'''

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




    def  lowercase_					(       self     ):





        '''simple docstring'''

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







import operator as op


def 							__snake_case							(    lowerCAmelCase_	)				->						str:
    SCREAMING_SNAKE_CASE__											=			[]
    SCREAMING_SNAKE_CASE__											=			lambda lowerCAmelCase_ ,							lowerCAmelCase_	: int(x / y	)  # noqa: E731 integer division operation
    SCREAMING_SNAKE_CASE__											=			{
        '''^''': op.pow,
        '''*''': op.mul,
        '''/''': div,
        '''+''': op.add,
        '''-''': op.sub,
    }  # operators & their respective operation

    # print table header
    print('''Symbol'''.center(8	) ,							'''Action'''.center(1_2	) ,							'''Stack''' ,							sep=''' | '''	)
    print('''-''' * (3_0 + len(lowerCAmelCase_	))	)

    for x in post_fix:
        if x.isdigit():  # if x in digit
            stack.append(lowerCAmelCase_	)  # append x to stack
            # output in tabular format
            print(x.rjust(8	) ,							('''push(''' + x + ''')''').ljust(1_2	) ,							''','''.join(lowerCAmelCase_	) ,							sep=''' | '''	)
        else:
            SCREAMING_SNAKE_CASE__											=			stack.pop()  # pop stack
            # output in tabular format
            print(''''''.rjust(8	) ,							('''pop(''' + b + ''')''').ljust(1_2	) ,							''','''.join(lowerCAmelCase_	) ,							sep=''' | '''	)

            SCREAMING_SNAKE_CASE__											=			stack.pop()  # pop stack
            # output in tabular format
            print(''''''.rjust(8	) ,							('''pop(''' + a + ''')''').ljust(1_2	) ,							''','''.join(lowerCAmelCase_	) ,							sep=''' | '''	)

            stack.append(
                str(opr[x](int(lowerCAmelCase_	) ,							int(lowerCAmelCase_	)	)	)	)  # evaluate the 2 values popped from stack & push result to stack
            # output in tabular format
            print(
                x.rjust(8	) ,							('''push(''' + a + x + b + ''')''').ljust(1_2	) ,							''','''.join(lowerCAmelCase_	) ,							sep=''' | ''' ,							)

    return int(stack[0]	)


if __name__ == "__main__":
  _A					:				Dict				=			input("""\n\nEnter a Postfix Equation (space separated) = """).split(""" """)
  print("""\n\tResult = """, solve(Postfix))
