


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   __a      (   unittest.TestCase				):
 @slow
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    List[str]:




        '''simple docstring'''
        # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        for model_name in ["bert-base-uncased"]:
               lowercase__:       Optional[Any]        =       AutoConfig.from_pretrained(lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       Optional[int]        =       TFAutoModel.from_pretrained(lowerCAmelCase__    ,			from_pt=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       Union[str, Any]        =       AutoModel.from_pretrained(lowerCAmelCase__    ,			from_tf=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)
 @slow
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    Any:




        '''simple docstring'''
        # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        for model_name in ["bert-base-uncased"]:
               lowercase__:       int        =       AutoConfig.from_pretrained(lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       List[Any]        =       TFAutoModelForPreTraining.from_pretrained(lowerCAmelCase__    ,			from_pt=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       Optional[Any]        =       AutoModelForPreTraining.from_pretrained(lowerCAmelCase__    ,			from_tf=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)
 @slow
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    Optional[Any]:




        '''simple docstring'''
        for model_name in TF_GPT2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
               lowercase__:       Union[str, Any]        =       AutoConfig.from_pretrained(lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       Optional[Any]        =       TFAutoModelForCausalLM.from_pretrained(lowerCAmelCase__    ,			from_pt=lowerCAmelCase__			)
               lowercase__      ,						lowercase__:       Optional[int]        =       TFAutoModelForCausalLM.from_pretrained(
                   lowerCAmelCase__    ,			output_loading_info=lowerCAmelCase__    ,			from_pt=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       Optional[int]        =       AutoModelForCausalLM.from_pretrained(lowerCAmelCase__    ,			from_tf=lowerCAmelCase__			)
               lowercase__      ,						lowercase__:       List[Any]        =       AutoModelForCausalLM.from_pretrained(
                   lowerCAmelCase__    ,			output_loading_info=lowerCAmelCase__    ,			from_tf=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)
 @slow
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    Tuple:




        '''simple docstring'''
        for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
               lowercase__:       Optional[Any]        =       AutoConfig.from_pretrained(lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       Optional[Any]        =       TFAutoModelWithLMHead.from_pretrained(lowerCAmelCase__    ,			from_pt=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       str        =       AutoModelWithLMHead.from_pretrained(lowerCAmelCase__    ,			from_tf=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)
 @slow
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    Optional[Any]:




        '''simple docstring'''
        for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
               lowercase__:       int        =       AutoConfig.from_pretrained(lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       Optional[Any]        =       TFAutoModelForMaskedLM.from_pretrained(lowerCAmelCase__    ,			from_pt=lowerCAmelCase__			)
               lowercase__      ,						lowercase__:       Optional[int]        =       TFAutoModelForMaskedLM.from_pretrained(
                   lowerCAmelCase__    ,			output_loading_info=lowerCAmelCase__    ,			from_pt=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       List[str]        =       AutoModelForMaskedLM.from_pretrained(lowerCAmelCase__    ,			from_tf=lowerCAmelCase__			)
               lowercase__      ,						lowercase__:       Optional[int]        =       AutoModelForMaskedLM.from_pretrained(
                   lowerCAmelCase__    ,			output_loading_info=lowerCAmelCase__    ,			from_tf=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)
 @slow
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    Dict:




        '''simple docstring'''
        for model_name in TF_T5_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
               lowercase__:       List[str]        =       AutoConfig.from_pretrained(lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       Any        =       TFAutoModelForSeqaSeqLM.from_pretrained(lowerCAmelCase__    ,			from_pt=lowerCAmelCase__			)
               lowercase__      ,						lowercase__:       List[Any]        =       TFAutoModelForSeqaSeqLM.from_pretrained(
                   lowerCAmelCase__    ,			output_loading_info=lowerCAmelCase__    ,			from_pt=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       Any        =       AutoModelForSeqaSeqLM.from_pretrained(lowerCAmelCase__    ,			from_tf=lowerCAmelCase__			)
               lowercase__      ,						lowercase__:       str        =       AutoModelForSeqaSeqLM.from_pretrained(
                   lowerCAmelCase__    ,			output_loading_info=lowerCAmelCase__    ,			from_tf=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)
 @slow
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    Tuple:




        '''simple docstring'''
        # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        for model_name in ["bert-base-uncased"]:
               lowercase__:       Union[str, Any]        =       AutoConfig.from_pretrained(lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       Any        =       TFAutoModelForSequenceClassification.from_pretrained(lowerCAmelCase__    ,			from_pt=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       Optional[Any]        =       AutoModelForSequenceClassification.from_pretrained(lowerCAmelCase__    ,			from_tf=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)
 @slow
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    Any:




        '''simple docstring'''
        # for model_name in TF_BERT_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
        for model_name in ["bert-base-uncased"]:
               lowercase__:       List[str]        =       AutoConfig.from_pretrained(lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       int        =       TFAutoModelForQuestionAnswering.from_pretrained(lowerCAmelCase__    ,			from_pt=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)

               lowercase__:       str        =       AutoModelForQuestionAnswering.from_pretrained(lowerCAmelCase__    ,			from_tf=lowerCAmelCase__			)
               self.assertIsNotNone(lowerCAmelCase__			)
               self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    List[str]:




        '''simple docstring'''
        lowercase__:       List[Any]        =       TFAutoModelWithLMHead.from_pretrained(lowerCAmelCase__    ,			from_pt=lowerCAmelCase__			)
        self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)
        self.assertEqual(model.num_parameters()    ,			14_410			)
        self.assertEqual(model.num_parameters(only_trainable=lowerCAmelCase__			)    ,			14_410			)

        lowercase__:       List[str]        =       AutoModelWithLMHead.from_pretrained(lowerCAmelCase__    ,			from_tf=lowerCAmelCase__			)
        self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)
        self.assertEqual(model.num_parameters()    ,			14_410			)
        self.assertEqual(model.num_parameters(only_trainable=lowerCAmelCase__			)    ,			14_410			)
 def 		SCREAMING_SNAKE_CASE__       (       self			) ->    Union[str, Any]:




        '''simple docstring'''
        lowercase__:       Optional[Any]        =       TFAutoModelWithLMHead.from_pretrained(lowerCAmelCase__    ,			from_pt=lowerCAmelCase__			)
        self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)
        self.assertEqual(model.num_parameters()    ,			14_410			)
        self.assertEqual(model.num_parameters(only_trainable=lowerCAmelCase__			)    ,			14_410			)

        lowercase__:       Union[str, Any]        =       AutoModelWithLMHead.from_pretrained(lowerCAmelCase__    ,			from_tf=lowerCAmelCase__			)
        self.assertIsInstance(lowerCAmelCase__    ,			lowerCAmelCase__			)
        self.assertEqual(model.num_parameters()    ,			14_410			)
        self.assertEqual(model.num_parameters(only_trainable=lowerCAmelCase__			)    ,			14_410			)






from __future__ import annotations




def        snake_case_					(  snake_case      ,							snake_case					)  ->    list[int]:
       lowercase__:       Tuple        =       0
       lowercase__:       str        =       len(snake_case					) - 1

       while i < j:
              if nums[i] + nums[j] == target:
                     return [i, j]
              elif nums[i] + nums[j] < target:
                     lowercase__:       str        =       i + 1
              else:
                     lowercase__:       Dict        =       j - 1

       return []


if __name__ == "__main__":
 import doctest

 doctest.testmod()
 print(F'''{two_pointer([2, 7, 11, 15], 9) = }''')


