import functools

def 							UpperCamelCase				(    lowerCAmelCase_       ,					lowerCAmelCase_   ):




       '''simple docstring'''






       _A=	len(lowerCAmelCase_   )
       _A=	len(lowerCAmelCase_   )

       @functools.cache
       def min_distance(lowerCAmelCase_       ,					lowerCAmelCase_   ) -> int:
              # if first word index is overflow - delete all from the second word
              if indexa >= len_worda:
                     return len_worda - indexa
              # if second word index is overflow - delete all from the first word
              if indexa >= len_worda:
                     return len_worda - indexa
              _A=	int(worda[indexa] != worda[indexa]   )  # current letters not identical
              return min(
                  1 + min_distance(indexa + 1       ,					lowerCAmelCase_   )       ,					1 + min_distance(lowerCAmelCase_       ,					indexa + 1   )       ,					diff + min_distance(indexa + 1       ,					indexa + 1   )       ,					)

       return min_distance(0       ,					0   )


if __name__ == "__main__":
      import doctest

      doctest.testmod()
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			):



     @slow
     def 			a__  (					self       ):
            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 			a__  (					self       ):
            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 			a__  (					self       ):
            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__       ):
                          return model(**lowerCAmelCase__       )

                   eval(**lowerCAmelCase__       ).block_until_ready()



     @slow
     def 			a__  (					self       ):
            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__       ):
                          return model(**lowerCAmelCase__       )

                   eval(**lowerCAmelCase__       ).block_until_ready()



     def 			a__  (					self       ):
            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 			a__  (					self       ):
            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 			a__  (					self       ):
            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 			a__  (					self       ):
            with self.assertRaisesRegex(lowerCAmelCase__				,      'Use `from_pt=True` to load this model'       ):
                   _A=	FlaxAutoModel.from_pretrained('hf-internal-testing/tiny-bert-pt-only'       )