



"""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 				lowerCamelCase  :






					'''simple docstring'''





					def __init__(       self:							Optional[Any]						,     snake_case:							Tuple						,     snake_case:							Union[str, Any]=13						,     snake_case:							Optional[int]=7						,     snake_case:							Union[str, Any]=True						,     snake_case:							Any=True						,     snake_case:							str=True						,     snake_case:							Dict=True						,     snake_case:							int=99						,     snake_case:							Optional[Any]=32						,     snake_case:							Optional[Any]=2						,     snake_case:							Tuple=4						,     snake_case:							int=37						,     snake_case:							Any="gelu"						,     snake_case:							List[str]=0.1						,     snake_case:							List[Any]=0.1						,     snake_case:							Optional[int]=512						,     snake_case:							int=16						,     snake_case:							str=2						,     snake_case:							int=0.0_2						,     snake_case:							str=False						,     snake_case:							Any=True						,     snake_case:							List[Any]="None"						,     snake_case:							Optional[Any]=3						,     snake_case:							Optional[Any]=4						,     snake_case:							List[str]=None						,     )   ->	str:
											snake_case_ :Optional[Any]						=			parent
											snake_case_ :str						=			batch_size
											snake_case_ :Tuple						=			seq_length
											snake_case_ :Any						=			is_training
											snake_case_ :Dict						=			use_input_mask
											snake_case_ :str						=			use_token_type_ids
											snake_case_ :List[str]						=			use_labels
											snake_case_ :Optional[int]						=			vocab_size
											snake_case_ :Dict						=			hidden_size
											snake_case_ :List[Any]						=			num_hidden_layers
											snake_case_ :Optional[Any]						=			num_attention_heads
											snake_case_ :int						=			intermediate_size
											snake_case_ :Optional[Any]						=			hidden_act
											snake_case_ :Dict						=			hidden_dropout_prob
											snake_case_ :str						=			attention_probs_dropout_prob
											snake_case_ :int						=			max_position_embeddings
											snake_case_ :int						=			type_vocab_size
											snake_case_ :Tuple						=			type_sequence_label_size
											snake_case_ :Dict						=			initializer_range
											snake_case_ :List[str]						=			num_labels
											snake_case_ :Union[str, Any]						=			num_choices
											snake_case_ :str						=			relative_attention
											snake_case_ :Any						=			position_biased_input
											snake_case_ :str						=			pos_att_type
											snake_case_ :int						=			scope






					def    lowerCAmelCase_				(       self:							List[str]						)   ->	Any:
											snake_case_ :str						=			ids_tensor([self.batch_size, self.seq_length]						,     self.vocab_size						)

											snake_case_ :List[Any]						=			None
											if self.use_input_mask:
																	snake_case_ :Tuple						=			random_attention_mask([self.batch_size, self.seq_length]						)

											snake_case_ :List[str]						=			None
											if self.use_token_type_ids:
																	snake_case_ :Tuple						=			ids_tensor([self.batch_size, self.seq_length]						,     self.type_vocab_size						)

											snake_case_ :Union[str, Any]						=			None
											snake_case_ :Dict						=			None
											snake_case_ :List[str]						=			None
											if self.use_labels:
																	snake_case_ :Union[str, Any]						=			ids_tensor([self.batch_size]						,     self.type_sequence_label_size						)
																	snake_case_ :List[Any]						=			ids_tensor([self.batch_size, self.seq_length]						,     self.num_labels						)

											snake_case_ :int						=			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=snake_case						,     )

											return config, input_ids, token_type_ids, input_mask, sequence_labels, token_labels, choice_labels






					def    lowerCAmelCase_				(       self:							Optional[int]						,     snake_case:							List[str]						,     snake_case:							Optional[int]						,     snake_case:							str						,     snake_case:							Any						,     snake_case:							List[str]						,     snake_case:							List[str]						,     snake_case:							str						)   ->	Any:
											snake_case_ :Any						=			TFDebertaVaModel(config=snake_case						)
											snake_case_ :List[str]						=			{"""input_ids""": input_ids, """attention_mask""": input_mask, """token_type_ids""": token_type_ids}

											snake_case_ :int						=			[input_ids, input_mask]
											snake_case_ :Dict						=			model(snake_case						)

											snake_case_ :List[Any]						=			model(snake_case						)

											self.parent.assertEqual(result.last_hidden_state.shape						,     (self.batch_size, self.seq_length, self.hidden_size)						)






					def    lowerCAmelCase_				(       self:							Optional[Any]						,     snake_case:							Optional[Any]						,     snake_case:							List[Any]						,     snake_case:							str						,     snake_case:							int						,     snake_case:							List[Any]						,     snake_case:							int						,     snake_case:							int						)   ->	Optional[Any]:
											snake_case_ :str						=			TFDebertaVaForMaskedLM(config=snake_case						)
											snake_case_ :Optional[Any]						=			{
											    """input_ids""": input_ids,
											    """attention_mask""": input_mask,
											    """token_type_ids""": token_type_ids,
											}
											snake_case_ :Optional[Any]						=			model(snake_case						)
											self.parent.assertEqual(result.logits.shape						,     (self.batch_size, self.seq_length, self.vocab_size)						)






					def    lowerCAmelCase_				(       self:							int						,     snake_case:							str						,     snake_case:							List[Any]						,     snake_case:							int						,     snake_case:							Union[str, Any]						,     snake_case:							Tuple						,     snake_case:							int						,     snake_case:							str						)   ->	str:
											snake_case_ :Tuple						=			self.num_labels
											snake_case_ :Tuple						=			TFDebertaVaForSequenceClassification(config=snake_case						)
											snake_case_ :List[str]						=			{
											    """input_ids""": input_ids,
											    """attention_mask""": input_mask,
											    """token_type_ids""": token_type_ids,
											}

											snake_case_ :int						=			model(snake_case						)
											self.parent.assertEqual(result.logits.shape						,     (self.batch_size, self.num_labels)						)






					def    lowerCAmelCase_				(       self:							List[Any]						,     snake_case:							Union[str, Any]						,     snake_case:							int						,     snake_case:							Tuple						,     snake_case:							int						,     snake_case:							Optional[int]						,     snake_case:							str						,     snake_case:							List[Any]						)   ->	List[str]:
											snake_case_ :Optional[Any]						=			self.num_labels
											snake_case_ :Any						=			TFDebertaVaForTokenClassification(config=snake_case						)
											snake_case_ :Union[str, Any]						=			{
											    """input_ids""": input_ids,
											    """attention_mask""": input_mask,
											    """token_type_ids""": token_type_ids,
											}
											snake_case_ :int						=			model(snake_case						)
											self.parent.assertEqual(result.logits.shape						,     (self.batch_size, self.seq_length, self.num_labels)						)






					def    lowerCAmelCase_				(       self:							List[str]						,     snake_case:							Optional[int]						,     snake_case:							str						,     snake_case:							List[Any]						,     snake_case:							Any						,     snake_case:							Dict						,     snake_case:							Union[str, Any]						,     snake_case:							Optional[int]						)   ->	str:
											snake_case_ :Dict						=			TFDebertaVaForQuestionAnswering(config=snake_case						)
											snake_case_ :Any						=			{
											    """input_ids""": input_ids,
											    """attention_mask""": input_mask,
											    """token_type_ids""": token_type_ids,
											}

											snake_case_ :Tuple						=			model(snake_case						)
											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    lowerCAmelCase_				(       self:							Union[str, Any]						)   ->	Any:
											snake_case_ :Optional[int]						=			self.prepare_config_and_inputs()
											(
											    (
											    snake_case_
											),       (
											    snake_case_
											),       (
											    snake_case_
											),       (
											    snake_case_
											),       (
											    snake_case_
											),       (
											    snake_case_
											),       (
											    snake_case_
											),       
											) :Tuple						=			config_and_inputs
											snake_case_ :List[str]						=			{"""input_ids""": input_ids, """token_type_ids""": token_type_ids, """attention_mask""": input_mask}
											return config, inputs_dict

@require_tf
class 				lowerCamelCase  (			_lowerCAmelCase    ,						_lowerCAmelCase    ,						unittest.TestCase				):






					'''simple docstring'''





					_A		:			Dict						=     (
					    (
					        TFDebertaVaModel,
					        TFDebertaVaForMaskedLM,
					        TFDebertaVaForQuestionAnswering,
					        TFDebertaVaForSequenceClassification,
					        TFDebertaVaForTokenClassification,
					    )
					    if is_tf_available()
					    else ()
					)
					_A		:			Any						=     (
					    {
					        """feature-extraction""": TFDebertaVaModel,
					        """fill-mask""": TFDebertaVaForMaskedLM,
					        """question-answering""": TFDebertaVaForQuestionAnswering,
					        """text-classification""": TFDebertaVaForSequenceClassification,
					        """token-classification""": TFDebertaVaForTokenClassification,
					        """zero-shot""": TFDebertaVaForSequenceClassification,
					    }
					    if is_tf_available()
					    else {}
					)

					_A		:			Any						=     False
					_A		:			List[Any]						=     False






					def    lowerCAmelCase_				(       self:							Dict						)   ->	List[str]:
											snake_case_ :Optional[Any]						=			TFDebertaVaModelTester(self						)
											snake_case_ :List[Any]						=			ConfigTester(self						,     config_class=snake_case						,     hidden_size=37						)






					def    lowerCAmelCase_				(       self:							Union[str, Any]						)   ->	Any:
											self.config_tester.run_common_tests()






					def    lowerCAmelCase_				(       self:							Optional[Any]						)   ->	str:
											snake_case_ :Dict						=			self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_model(*snake_case						)






					def    lowerCAmelCase_				(       self:							Optional[int]						)   ->	Optional[Any]:
											snake_case_ :Dict						=			self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_masked_lm(*snake_case						)






					def    lowerCAmelCase_				(       self:							str						)   ->	List[Any]:
											snake_case_ :Any						=			self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_question_answering(*snake_case						)






					def    lowerCAmelCase_				(       self:							List[str]						)   ->	Optional[int]:
											snake_case_ :List[str]						=			self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_sequence_classification(*snake_case						)






					def    lowerCAmelCase_				(       self:							Any						)   ->	Optional[Any]:
											snake_case_ :Union[str, Any]						=			self.model_tester.prepare_config_and_inputs()
											self.model_tester.create_and_check_for_token_classification(*snake_case						)






					@slow
					def    lowerCAmelCase_				(       self:							Tuple						)   ->	List[Any]:
											snake_case_ :List[Any]						=			TFDebertaVaModel.from_pretrained("""kamalkraj/deberta-v2-xlarge"""						)
											self.assertIsNotNone(snake_case						)

@require_tf
class 				lowerCamelCase  (			unittest.TestCase				):






					'''simple docstring'''





					@unittest.skip(reason="""Model not available yet"""						)
					def    lowerCAmelCase_				(       self:							Tuple						)   ->	int:
											pass






					@slow
					def    lowerCAmelCase_				(       self:							List[Any]						)   ->	int:
											snake_case_ :List[Any]						=			TFDebertaVaModel.from_pretrained("""kamalkraj/deberta-v2-xlarge"""						)
											snake_case_ :Optional[int]						=			tf.constant([[0, 31_414, 232, 328, 740, 1_140, 12_695, 69, 46_078, 1_588, 2]]						)
											snake_case_ :int						=			tf.constant([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]						)
											snake_case_ :Optional[int]						=			model(snake_case						,     attention_mask=snake_case						)[0]

											snake_case_ :Tuple						=			tf.constant(
											    [[[0.2_3_5_6, 0.1_9_4_8, 0.0_3_6_9], [-0.1_0_6_3, 0.3_5_8_6, -0.5_1_5_2], [-0.6_3_9_9, -0.0_2_5_9, -0.2_5_2_5]]]						)
											tf.debugging.assert_near(output[:, 1:4, 1:4]						,     snake_case						,     atol=1E-4						)





"""simple docstring"""






import os
from math import logaa


def 			_lowercase				(  __snake_case = "base_exp.txt"	)						->   int:
			__lowerCAmelCase      :  float												=       0
			__lowerCAmelCase      :  Any												=       0
			for i, line in enumerate(open(os.path.join(os.path.dirname(__snake_case	)					,__snake_case	)	)	):
						__lowerCAmelCase						,	__lowerCAmelCase      :  List[str]												=       list(map(__snake_case					,line.split(","	)	)	)
						if x * logaa(__snake_case	) > largest:
									__lowerCAmelCase      :  Tuple												=       x * logaa(__snake_case	)
									__lowerCAmelCase      :  Optional[Any]												=       i + 1
			return result


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