




'''simple docstring'''







from __future__ import annotations

import unittest

from transformers import DebertaVaConfig, is_tf_available
from transformers.testing_utils import require_tf, slow

from ...test_configuration_common import ConfigTester
from ...test_modeling_tf_common import TFModelTesterMixin, ids_tensor, random_attention_mask
from ...test_pipeline_mixin import PipelineTesterMixin


if is_tf_available():
   import tensorflow as tf

   from transformers import (
       TFDebertaVaForMaskedLM,
       TFDebertaVaForQuestionAnswering,
       TFDebertaVaForSequenceClassification,
       TFDebertaVaForTokenClassification,
       TFDebertaVaModel,
   )


class     _a						:
       def __init__(			self		:			Optional[Any]     ,       lowercase		:			Any     ,       lowercase		:			Optional[Any]=13     ,       lowercase		:			List[str]=7     ,       lowercase		:			Tuple=True     ,       lowercase		:			Optional[Any]=True     ,       lowercase		:			List[str]=True     ,       lowercase		:			Tuple=True     ,       lowercase		:			Dict=99     ,       lowercase		:			int=32     ,       lowercase		:			List[Any]=2     ,       lowercase		:			Dict=4     ,       lowercase		:			Dict=37     ,       lowercase		:			List[Any]="gelu"     ,       lowercase		:			Union[str, Any]=0.1     ,       lowercase		:			List[Any]=0.1     ,       lowercase		:			Optional[Any]=512     ,       lowercase		:			List[Any]=16     ,       lowercase		:			List[Any]=2     ,       lowercase		:			Tuple=0.02     ,       lowercase		:			Tuple=False     ,       lowercase		:			Tuple=True     ,       lowercase		:			List[str]="None"     ,       lowercase		:			int=3     ,       lowercase		:			List[Any]=4     ,       lowercase		:			int=None     ,       ):



           '''simple docstring'''

           UpperCAmelCase     =	parent
           UpperCAmelCase     =	batch_size
           UpperCAmelCase     =	seq_length
           UpperCAmelCase     =	is_training
           UpperCAmelCase     =	use_input_mask
           UpperCAmelCase     =	use_token_type_ids
           UpperCAmelCase     =	use_labels
           UpperCAmelCase     =	vocab_size
           UpperCAmelCase     =	hidden_size
           UpperCAmelCase     =	num_hidden_layers
           UpperCAmelCase     =	num_attention_heads
           UpperCAmelCase     =	intermediate_size
           UpperCAmelCase     =	hidden_act
           UpperCAmelCase     =	hidden_dropout_prob
           UpperCAmelCase     =	attention_probs_dropout_prob
           UpperCAmelCase     =	max_position_embeddings
           UpperCAmelCase     =	type_vocab_size
           UpperCAmelCase     =	type_sequence_label_size
           UpperCAmelCase     =	initializer_range
           UpperCAmelCase     =	num_labels
           UpperCAmelCase     =	num_choices
           UpperCAmelCase     =	relative_attention
           UpperCAmelCase     =	position_biased_input
           UpperCAmelCase     =	pos_att_type
           UpperCAmelCase     =	scope
       def 					A   (			self		:			Dict       ):



           '''simple docstring'''

           UpperCAmelCase     =	ids_tensor([self.batch_size, self.seq_length]     ,       self.vocab_size       )

           UpperCAmelCase     =	None
           if self.use_input_mask:
               UpperCAmelCase     =	random_attention_mask([self.batch_size, self.seq_length]       )

           UpperCAmelCase     =	None
           if self.use_token_type_ids:
               UpperCAmelCase     =	ids_tensor([self.batch_size, self.seq_length]     ,       self.type_vocab_size       )

           UpperCAmelCase     =	None
           UpperCAmelCase     =	None
           UpperCAmelCase     =	None
           if self.use_labels:
               UpperCAmelCase     =	ids_tensor([self.batch_size]     ,       self.type_sequence_label_size       )
               UpperCAmelCase     =	ids_tensor([self.batch_size, self.seq_length]     ,       self.num_labels       )

           UpperCAmelCase     =	DebertaVaConfig(
               vocab_size=self.vocab_size     ,       hidden_size=self.hidden_size     ,       num_hidden_layers=self.num_hidden_layers     ,       num_attention_heads=self.num_attention_heads     ,       intermediate_size=self.intermediate_size     ,       hidden_act=self.hidden_act     ,       hidden_dropout_prob=self.hidden_dropout_prob     ,       attention_probs_dropout_prob=self.attention_probs_dropout_prob     ,       max_position_embeddings=self.max_position_embeddings     ,       type_vocab_size=self.type_vocab_size     ,       relative_attention=self.relative_attention     ,       position_biased_input=self.position_biased_input     ,       initializer_range=self.initializer_range     ,       return_dict=_lowercase     ,       )

           return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels
       def 					A   (			self		:			Union[str, Any]     ,       lowercase		:			List[Any]     ,       lowercase		:			Union[str, Any]     ,       lowercase		:			Any     ,       lowercase		:			str     ,       lowercase		:			str     ,       lowercase		:			str     ,       lowercase		:			List[Any]       ):



           '''simple docstring'''

           UpperCAmelCase     =	TFDebertaVaModel(config=_lowercase       )
           UpperCAmelCase     =	{"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}

           UpperCAmelCase     =	[input_ids, input_mask]
           UpperCAmelCase     =	model(_lowercase       )

           UpperCAmelCase     =	model(_lowercase       )

           self.parent.assertEqual(result.last_hidden_state.shape     ,       (self.batch_size, self.seq_length, self.hidden_size)       )
       def 					A   (			self		:			Any     ,       lowercase		:			Optional[Any]     ,       lowercase		:			Any     ,       lowercase		:			Tuple     ,       lowercase		:			str     ,       lowercase		:			str     ,       lowercase		:			str     ,       lowercase		:			List[Any]       ):



           '''simple docstring'''

           UpperCAmelCase     =	TFDebertaVaForMaskedLM(config=_lowercase       )
           UpperCAmelCase     =	{
               """input_ids""": input_ids,
               """attention_mask""": input_mask,
               """token_type_ids""": token_type_ids,
           }
           UpperCAmelCase     =	model(_lowercase       )
           self.parent.assertEqual(result.logits.shape     ,       (self.batch_size, self.seq_length, self.vocab_size)       )
       def 					A   (			self		:			List[str]     ,       lowercase		:			List[Any]     ,       lowercase		:			List[Any]     ,       lowercase		:			Tuple     ,       lowercase		:			List[str]     ,       lowercase		:			int     ,       lowercase		:			Dict     ,       lowercase		:			int       ):



           '''simple docstring'''

           UpperCAmelCase     =	self.num_labels
           UpperCAmelCase     =	TFDebertaVaForSequenceClassification(config=_lowercase       )
           UpperCAmelCase     =	{
               """input_ids""": input_ids,
               """attention_mask""": input_mask,
               """token_type_ids""": token_type_ids,
           }

           UpperCAmelCase     =	model(_lowercase       )
           self.parent.assertEqual(result.logits.shape     ,       (self.batch_size, self.num_labels)       )
       def 					A   (			self		:			Dict     ,       lowercase		:			Union[str, Any]     ,       lowercase		:			Dict     ,       lowercase		:			int     ,       lowercase		:			Optional[int]     ,       lowercase		:			List[str]     ,       lowercase		:			Dict     ,       lowercase		:			Dict       ):



           '''simple docstring'''

           UpperCAmelCase     =	self.num_labels
           UpperCAmelCase     =	TFDebertaVaForTokenClassification(config=_lowercase       )
           UpperCAmelCase     =	{
               """input_ids""": input_ids,
               """attention_mask""": input_mask,
               """token_type_ids""": token_type_ids,
           }
           UpperCAmelCase     =	model(_lowercase       )
           self.parent.assertEqual(result.logits.shape     ,       (self.batch_size, self.seq_length, self.num_labels)       )
       def 					A   (			self		:			Optional[Any]     ,       lowercase		:			Tuple     ,       lowercase		:			Union[str, Any]     ,       lowercase		:			Tuple     ,       lowercase		:			List[str]     ,       lowercase		:			Any     ,       lowercase		:			Union[str, Any]     ,       lowercase		:			Any       ):



           '''simple docstring'''

           UpperCAmelCase     =	TFDebertaVaForQuestionAnswering(config=_lowercase       )
           UpperCAmelCase     =	{
               """input_ids""": input_ids,
               """attention_mask""": input_mask,
               """token_type_ids""": token_type_ids,
           }

           UpperCAmelCase     =	model(_lowercase       )
           self.parent.assertEqual(result.start_logits.shape     ,       (self.batch_size, self.seq_length)       )
           self.parent.assertEqual(result.end_logits.shape     ,       (self.batch_size, self.seq_length)       )







       def 					A   (			self		:			Dict       ):



           '''simple docstring'''

           UpperCAmelCase     =	self.prepare_config_and_inputs()
           (
               UpperCAmelCase		
           )     =	config_and_inputs
           UpperCAmelCase     =	{"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": input_mask}
           return config, inputs_dict






@require_tf
class     _a						(			SCREAMING_SNAKE_CASE__							,							SCREAMING_SNAKE_CASE__							,							unittest.TestCase				):
       __a       :  str            =      (
           (
               TFDebertaVaModel,
               TFDebertaVaForMaskedLM,
               TFDebertaVaForQuestionAnswering,
               TFDebertaVaForSequenceClassification,
               TFDebertaVaForTokenClassification,
           )
           if is_tf_available()
           else ()
       )
       __a       :  Tuple            =      (
           {
               """feature-extraction""": TFDebertaVaModel,
               """fill-mask""": TFDebertaVaForMaskedLM,
               """question-answering""": TFDebertaVaForQuestionAnswering,
               """text-classification""": TFDebertaVaForSequenceClassification,
               """token-classification""": TFDebertaVaForTokenClassification,
               """zero-shot""": TFDebertaVaForSequenceClassification,
           }
           if is_tf_available()
           else {}
       )

       __a       :  List[str]            =      False
       __a       :  Dict            =      False
       def 					A   (			self		:			Optional[Any]       ):



           '''simple docstring'''

           UpperCAmelCase     =	TFDebertaVaModelTester(self       )
           UpperCAmelCase     =	ConfigTester(self     ,       config_class=_lowercase     ,       hidden_size=37       )
       def 					A   (			self		:			Optional[int]       ):



           '''simple docstring'''

           self.config_tester.run_common_tests()
       def 					A   (			self		:			str       ):



           '''simple docstring'''

           UpperCAmelCase     =	self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_model(*_lowercase       )
       def 					A   (			self		:			List[str]       ):



           '''simple docstring'''

           UpperCAmelCase     =	self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_for_masked_lm(*_lowercase       )
       def 					A   (			self		:			int       ):



           '''simple docstring'''

           UpperCAmelCase     =	self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_for_question_answering(*_lowercase       )
       def 					A   (			self		:			List[Any]       ):



           '''simple docstring'''

           UpperCAmelCase     =	self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_for_sequence_classification(*_lowercase       )
       def 					A   (			self		:			int       ):



           '''simple docstring'''

           UpperCAmelCase     =	self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_for_token_classification(*_lowercase       )







       @slow
       def 					A   (			self		:			Dict       ):



           '''simple docstring'''

           UpperCAmelCase     =	TFDebertaVaModel.from_pretrained('''kamalkraj/deberta-v2-xlarge'''       )
           self.assertIsNotNone(_lowercase       )






@require_tf
class     _a						(			unittest.TestCase				):
       @unittest.skip(reason='''Model not available yet'''       )
       def 					A   (			self		:			List[str]       ):



           '''simple docstring'''

           pass







       @slow
       def 					A   (			self		:			Optional[Any]       ):



           '''simple docstring'''

           UpperCAmelCase     =	TFDebertaVaModel.from_pretrained('''kamalkraj/deberta-v2-xlarge'''       )
           UpperCAmelCase     =	tf.constant([[0, 31_414, 232, 328, 740, 1_140, 12_695, 69, 46_078, 1_588, 2]]       )
           UpperCAmelCase     =	tf.constant([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]       )
           UpperCAmelCase     =	model(_lowercase     ,       attention_mask=_lowercase       )[0]

           UpperCAmelCase     =	tf.constant(
               [[[0.2356, 0.1948, 0.0369], [-0.1063, 0.3586, -0.5152], [-0.6399, -0.0259, -0.2525]]]       )
           tf.debugging.assert_near(output[:, 1:4, 1:4]     ,       _lowercase     ,       atol=1E-4       )










'''simple docstring'''







def 		snake_case_							():
    for n in range(1					,     1_0_0_0_0_0_0  ):
        yield n * (n + 1) // 2





def 		snake_case_							(_a			:							Union[str, Any]  ):
    UpperCAmelCase     =	1
    UpperCAmelCase     =	2
    while i * i <= n:
        UpperCAmelCase     =	0
        while n % i == 0:
            n //= i
            multiplicity += 1
        divisors_count *= multiplicity + 1
        i += 1
    if n > 1:
        divisors_count *= 2
    return divisors_count





def 		snake_case_							():
    return next(i for i in triangle_number_generator() if count_divisors(_a  ) > 5_0_0  )


if __name__ == "__main__":
   print(solution())




