




from __future__ import annotations

import unittest

from transformers import is_tf_available, is_torch_available
from transformers.testing_utils import DUMMY_UNKNOWN_IDENTIFIER, SMALL_MODEL_IDENTIFIER, is_pt_tf_cross_test, slow


if is_tf_available():
     from transformers import (
         AutoConfig,
         BertConfig,
         GPTaConfig,
         TaConfig,
         TFAutoModel,
         TFAutoModelForCausalLM,
         TFAutoModelForMaskedLM,
         TFAutoModelForPreTraining,
         TFAutoModelForQuestionAnswering,
         TFAutoModelForSeqaSeqLM,
         TFAutoModelForSequenceClassification,
         TFAutoModelWithLMHead,
         TFBertForMaskedLM,
         TFBertForPreTraining,
         TFBertForQuestionAnswering,
         TFBertForSequenceClassification,
         TFBertModel,
         TFGPTaLMHeadModel,
         TFRobertaForMaskedLM,
         TFTaForConditionalGeneration,
     )
     from transformers.models.bert.modeling_tf_bert import TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST
     from transformers.models.gpta.modeling_tf_gpta import TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST
     from transformers.models.ta.modeling_tf_ta import TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST

if is_torch_available():
     from transformers import (
         AutoModel,
         AutoModelForCausalLM,
         AutoModelForMaskedLM,
         AutoModelForPreTraining,
         AutoModelForQuestionAnswering,
         AutoModelForSeqaSeqLM,
         AutoModelForSequenceClassification,
         AutoModelWithLMHead,
         BertForMaskedLM,
         BertForPreTraining,
         BertForQuestionAnswering,
         BertForSequenceClassification,
         BertModel,
         GPTaLMHeadModel,
         RobertaForMaskedLM,
         TaForConditionalGeneration,
     )





@is_pt_tf_cross_test
class 			__lowerCamelCase	(   unittest.TestCase   ):




    """simple docstring"""

    @slow
    def        a				(	self					:					List[str]       )				->	int:
     # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
     for model_name in ["bert-base-uncased"]:
      lowerCAmelCase__          =			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			TFAutoModel.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_pt=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			AutoModel.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_tf=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )


    @slow
    def        a				(	self					:					Optional[Any]       )				->	Union[str, Any]:
     # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
     for model_name in ["bert-base-uncased"]:
      lowerCAmelCase__          =			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			TFAutoModelForPreTraining.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_pt=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			AutoModelForPreTraining.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_tf=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )


    @slow
    def        a				(	self					:					Tuple       )				->	Dict:
     for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
      lowerCAmelCase__          =			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			TFAutoModelForCausalLM.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_pt=SCREAMING_SNAKE_CASE__       )
      lowerCAmelCase__     ,		lowerCAmelCase__          =			TFAutoModelForCausalLM.from_pretrained(
          SCREAMING_SNAKE_CASE__       ,     output_loading_info=SCREAMING_SNAKE_CASE__       ,     from_pt=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			AutoModelForCausalLM.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_tf=SCREAMING_SNAKE_CASE__       )
      lowerCAmelCase__     ,		lowerCAmelCase__          =			AutoModelForCausalLM.from_pretrained(
          SCREAMING_SNAKE_CASE__       ,     output_loading_info=SCREAMING_SNAKE_CASE__       ,     from_tf=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )


    @slow
    def        a				(	self					:					Union[str, Any]       )				->	Any:
     for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
      lowerCAmelCase__          =			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			TFAutoModelWithLMHead.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_pt=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			AutoModelWithLMHead.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_tf=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )


    @slow
    def        a				(	self					:					Dict       )				->	int:
     for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
      lowerCAmelCase__          =			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			TFAutoModelForMaskedLM.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_pt=SCREAMING_SNAKE_CASE__       )
      lowerCAmelCase__     ,		lowerCAmelCase__          =			TFAutoModelForMaskedLM.from_pretrained(
          SCREAMING_SNAKE_CASE__       ,     output_loading_info=SCREAMING_SNAKE_CASE__       ,     from_pt=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			AutoModelForMaskedLM.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_tf=SCREAMING_SNAKE_CASE__       )
      lowerCAmelCase__     ,		lowerCAmelCase__          =			AutoModelForMaskedLM.from_pretrained(
          SCREAMING_SNAKE_CASE__       ,     output_loading_info=SCREAMING_SNAKE_CASE__       ,     from_tf=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )


    @slow
    def        a				(	self					:					List[str]       )				->	List[Any]:
     for model_name in TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
      lowerCAmelCase__          =			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			TFAutoModelForSeqaSeqLM.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_pt=SCREAMING_SNAKE_CASE__       )
      lowerCAmelCase__     ,		lowerCAmelCase__          =			TFAutoModelForSeqaSeqLM.from_pretrained(
          SCREAMING_SNAKE_CASE__       ,     output_loading_info=SCREAMING_SNAKE_CASE__       ,     from_pt=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			AutoModelForSeqaSeqLM.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_tf=SCREAMING_SNAKE_CASE__       )
      lowerCAmelCase__     ,		lowerCAmelCase__          =			AutoModelForSeqaSeqLM.from_pretrained(
          SCREAMING_SNAKE_CASE__       ,     output_loading_info=SCREAMING_SNAKE_CASE__       ,     from_tf=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )


    @slow
    def        a				(	self					:					List[str]       )				->	int:
     # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
     for model_name in ["bert-base-uncased"]:
      lowerCAmelCase__          =			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			TFAutoModelForSequenceClassification.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_pt=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			AutoModelForSequenceClassification.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_tf=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )


    @slow
    def        a				(	self					:					Tuple       )				->	Any:
     # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
     for model_name in ["bert-base-uncased"]:
      lowerCAmelCase__          =			AutoConfig.from_pretrained(SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			TFAutoModelForQuestionAnswering.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_pt=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )

      lowerCAmelCase__          =			AutoModelForQuestionAnswering.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_tf=SCREAMING_SNAKE_CASE__       )
      self.assertIsNotNone(SCREAMING_SNAKE_CASE__       )
      self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )


    def        a				(	self					:					Any       )				->	Optional[int]:
     lowerCAmelCase__          =			TFAutoModelWithLMHead.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_pt=SCREAMING_SNAKE_CASE__       )
     self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )
     self.assertEqual(model.num_parameters()       ,     14_410       )
     self.assertEqual(model.num_parameters(only_trainable=SCREAMING_SNAKE_CASE__       )       ,     14_410       )

     lowerCAmelCase__          =			AutoModelWithLMHead.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_tf=SCREAMING_SNAKE_CASE__       )
     self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )
     self.assertEqual(model.num_parameters()       ,     14_410       )
     self.assertEqual(model.num_parameters(only_trainable=SCREAMING_SNAKE_CASE__       )       ,     14_410       )


    def        a				(	self					:					Dict       )				->	Optional[Any]:
     lowerCAmelCase__          =			TFAutoModelWithLMHead.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_pt=SCREAMING_SNAKE_CASE__       )
     self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )
     self.assertEqual(model.num_parameters()       ,     14_410       )
     self.assertEqual(model.num_parameters(only_trainable=SCREAMING_SNAKE_CASE__       )       ,     14_410       )

     lowerCAmelCase__          =			AutoModelWithLMHead.from_pretrained(SCREAMING_SNAKE_CASE__       ,     from_tf=SCREAMING_SNAKE_CASE__       )
     self.assertIsInstance(SCREAMING_SNAKE_CASE__       ,     SCREAMING_SNAKE_CASE__       )
     self.assertEqual(model.num_parameters()       ,     14_410       )
     self.assertEqual(model.num_parameters(only_trainable=SCREAMING_SNAKE_CASE__       )       ,     14_410       )






import string



def 							_A       (						lowerCAmelCase_					: str      ):
     """simple docstring"""

     for key in range(len(string.ascii_uppercase      )      ):
          lowerCAmelCase__          =			""
          for symbol in message:
               if symbol in string.ascii_uppercase:
                    lowerCAmelCase__          =			string.ascii_uppercase.find(lowerCAmelCase_      )
                    lowerCAmelCase__          =			num - key
                    if num < 0:
                         lowerCAmelCase__          =			num + len(string.ascii_uppercase      )
                    lowerCAmelCase__          =			translated + string.ascii_uppercase[num]
               else:
                    lowerCAmelCase__          =			translated + symbol
          print(F'Decryption using Key #{key}: {translated}'      )



def 							_A       (						):
     """simple docstring"""

     lowerCAmelCase__          =			input("Encrypted message: "      )
     lowerCAmelCase__          =			message.upper()
     decrypt(lowerCAmelCase_      )


if __name__ == "__main__":
     import doctest

     doctest.testmod()
     main()
