
from __future__ import annotations

import unittest

from transformers import DebertaConfig, 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 (
							    TFDebertaForMaskedLM,
							    TFDebertaForQuestionAnswering,
							    TFDebertaForSequenceClassification,
							    TFDebertaForTokenClassification,
							    TFDebertaModel,
							)




class      __lowercase	:






	def __init__(self							:   Tuple			,  snake_case							:   Union[str, Any]			,  snake_case							:   List[Any]=13			,  snake_case							:   Union[str, Any]=7			,  snake_case							:   Union[str, Any]=True			,  snake_case							:   int=True			,  snake_case							:   Dict=True			,  snake_case							:   Union[str, Any]=True			,  snake_case							:   str=99			,  snake_case							:   str=32			,  snake_case							:   List[Any]=2			,  snake_case							:   Optional[int]=4			,  snake_case							:   Union[str, Any]=37			,  snake_case							:   int="gelu"			,  snake_case							:   Any=0.1			,  snake_case							:   str=0.1			,  snake_case							:   Dict=512			,  snake_case							:   Any=16			,  snake_case							:   Tuple=2			,  snake_case							:   Dict=0.02			,  snake_case							:   Tuple=3			,  snake_case							:   Dict=4			,  snake_case							:   Optional[Any]=None			,  )   -> str:
							_lowercase					:  Optional[int]    			=      parent
							_lowercase					:  Union[str, Any]    			=      13
							_lowercase					:  Dict    			=      7
							_lowercase					:  Any    			=      True
							_lowercase					:  Tuple    			=      True
							_lowercase					:  Optional[Any]    			=      True
							_lowercase					:  Optional[Any]    			=      True
							_lowercase					:  str    			=      99
							_lowercase					:  Optional[int]    			=      32
							_lowercase					:  int    			=      2
							_lowercase					:  Optional[int]    			=      4
							_lowercase					:  List[str]    			=      37
							_lowercase					:  Dict    			=      "gelu"
							_lowercase					:  str    			=      0.1
							_lowercase					:  Optional[int]    			=      0.1
							_lowercase					:  int    			=      512
							_lowercase					:  str    			=      16
							_lowercase					:  List[Any]    			=      False
							_lowercase					:  Dict    			=      -1
							_lowercase					:  Optional[Any]    			=      True
							_lowercase					:  Dict    			=      2
							_lowercase					:  Union[str, Any]    			=      0.02
							_lowercase					:  int    			=      3
							_lowercase					:  Tuple    			=      4
							_lowercase					:  Optional[Any]    			=      None






	def 			_a(self							:   List[str]						)   -> List[Any]:
							_lowercase					:  Optional[Any]    			=      ids_tensor([self.batch_size, self.seq_length]			,  self.vocab_size						)

							_lowercase					:  Optional[Any]    			=      None
							if self.use_input_mask:
													_lowercase					:  int    			=      random_attention_mask([self.batch_size, self.seq_length]						)

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

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

							_lowercase					:  Union[str, Any]    			=      DebertaConfig(
							    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			,  max_relative_positions=self.max_relative_positions			,  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 			_a(self							:   Dict			,  snake_case							:   Optional[Any]			,  snake_case							:   Optional[Any]			,  snake_case							:   List[Any]			,  snake_case							:   str			,  snake_case							:   Optional[int]			,  snake_case							:   List[Any]			,  snake_case							:   Union[str, Any]						)   -> str:
							_lowercase					:  Tuple    			=      TFDebertaModel(config=snake_case						)
							_lowercase					:  Any    			=      {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}

							_lowercase					:  Tuple    			=      [input_ids, input_mask]
							_lowercase					:  Any    			=      model(snake_case						)

							_lowercase					:  Any    			=      model(snake_case						)

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






	def 			_a(self							:   int			,  snake_case							:   int			,  snake_case							:   Union[str, Any]			,  snake_case							:   Tuple			,  snake_case							:   List[Any]			,  snake_case							:   Any			,  snake_case							:   Union[str, Any]			,  snake_case							:   int						)   -> int:
							_lowercase					:  int    			=      TFDebertaForMaskedLM(config=snake_case						)
							_lowercase					:  List[Any]    			=      {
							    "input_ids": input_ids,
							    "attention_mask": input_mask,
							    "token_type_ids": token_type_ids,
							}
							_lowercase					:  int    			=      model(snake_case						)
							self.parent.assertEqual(result.logits.shape			,  (self.batch_size, self.seq_length, self.vocab_size)						)






	def 			_a(self							:   str			,  snake_case							:   Dict			,  snake_case							:   Optional[int]			,  snake_case							:   int			,  snake_case							:   Tuple			,  snake_case							:   int			,  snake_case							:   Any			,  snake_case							:   Any						)   -> List[str]:
							_lowercase					:  Dict    			=      self.num_labels
							_lowercase					:  Tuple    			=      TFDebertaForSequenceClassification(config=snake_case						)
							_lowercase					:  Optional[Any]    			=      {
							    "input_ids": input_ids,
							    "attention_mask": input_mask,
							    "token_type_ids": token_type_ids,
							}

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






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






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

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




@require_tf
class      __lowercase	(	__snake_case      ,   __snake_case      ,   unittest.TestCase					):
	_A   			=      (
	    (
	        TFDebertaModel,
	        TFDebertaForMaskedLM,
	        TFDebertaForQuestionAnswering,
	        TFDebertaForSequenceClassification,
	        TFDebertaForTokenClassification,
	    )
	    if is_tf_available()
	    else ()
	)
	_A   			=      (
	    {
	        "feature-extraction": TFDebertaModel,
	        "fill-mask": TFDebertaForMaskedLM,
	        "question-answering": TFDebertaForQuestionAnswering,
	        "text-classification": TFDebertaForSequenceClassification,
	        "token-classification": TFDebertaForTokenClassification,
	        "zero-shot": TFDebertaForSequenceClassification,
	    }
	    if is_tf_available()
	    else {}
	)

	_A   			=      False
	_A   			=      False






	def 			_a(self							:   int						)   -> List[Any]:
							_lowercase					:  List[str]    			=      TFDebertaModelTester(self						)
							_lowercase					:  Optional[int]    			=      ConfigTester(self			,  config_class=snake_case			,  hidden_size=37						)






	def 			_a(self							:   Any						)   -> Tuple:
							self.config_tester.run_common_tests()






	def 			_a(self							:   Optional[Any]						)   -> Dict:
							_lowercase					:  Union[str, Any]    			=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*snake_case						)






	def 			_a(self							:   Optional[Any]						)   -> Any:
							_lowercase					:  Union[str, Any]    			=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_masked_lm(*snake_case						)






	def 			_a(self							:   str						)   -> int:
							_lowercase					:  int    			=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_question_answering(*snake_case						)






	def 			_a(self							:   Any						)   -> List[Any]:
							_lowercase					:  Any    			=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_sequence_classification(*snake_case						)






	def 			_a(self							:   Tuple						)   -> str:
							_lowercase					:  Union[str, Any]    			=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_token_classification(*snake_case						)






	@slow
	def 			_a(self							:   Optional[Any]						)   -> int:
							_lowercase					:  Optional[int]    			=      TFDebertaModel.from_pretrained("kamalkraj/deberta-base"						)
							self.assertIsNotNone(snake_case						)




@require_tf
class      __lowercase	(	unittest.TestCase					):






	@unittest.skip(reason="Model not available yet"						)
	def 			_a(self							:   Optional[int]						)   -> int:
							pass






	@slow
	def 			_a(self							:   Optional[int]						)   -> Optional[int]:
							_lowercase					:  Optional[Any]    			=      TFDebertaModel.from_pretrained("kamalkraj/deberta-base"						)
							_lowercase					:  List[Any]    			=      tf.constant([[0, 3_1414, 232, 328, 740, 1140, 1_2695, 69, 4_6078, 1588, 2]]						)
							_lowercase					:  Union[str, Any]    			=      tf.constant([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]						)
							_lowercase					:  List[str]    			=      model(snake_case			,  attention_mask=snake_case						)[0]

							_lowercase					:  List[str]    			=      tf.constant(
							    [
							        [
							            [-0.59_85_58_96, -0.80_55_25_66, -0.8_46_21_35],
							            [1.4_48_40_25, -0.93_48_37_94, -0.80_59_30_85],
							            [0.3_12_27_41, 0.00_31_60_59, -1.4_13_13_77],
							        ]
							    ]						)
							tf.debugging.assert_near(output[:, 1:4, 1:4]			,  snake_case			,  atol=1e-4						)






from __future__ import annotations

import unittest

from transformers import DebertaConfig, 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 (
							    TFDebertaForMaskedLM,
							    TFDebertaForQuestionAnswering,
							    TFDebertaForSequenceClassification,
							    TFDebertaForTokenClassification,
							    TFDebertaModel,
							)




class      __lowercase	:






	def __init__(self							:   Tuple			,  snake_case							:   Union[str, Any]			,  snake_case							:   List[Any]=13			,  snake_case							:   Union[str, Any]=7			,  snake_case							:   Union[str, Any]=True			,  snake_case							:   int=True			,  snake_case							:   Dict=True			,  snake_case							:   Union[str, Any]=True			,  snake_case							:   str=99			,  snake_case							:   str=32			,  snake_case							:   List[Any]=2			,  snake_case							:   Optional[int]=4			,  snake_case							:   Union[str, Any]=37			,  snake_case							:   int="gelu"			,  snake_case							:   Any=0.1			,  snake_case							:   str=0.1			,  snake_case							:   Dict=512			,  snake_case							:   Any=16			,  snake_case							:   Tuple=2			,  snake_case							:   Dict=0.02			,  snake_case							:   Tuple=3			,  snake_case							:   Dict=4			,  snake_case							:   Optional[Any]=None			,  )   -> str:
							_lowercase					:  Optional[int]    			=      parent
							_lowercase					:  Union[str, Any]    			=      13
							_lowercase					:  Dict    			=      7
							_lowercase					:  Any    			=      True
							_lowercase					:  Tuple    			=      True
							_lowercase					:  Optional[Any]    			=      True
							_lowercase					:  Optional[Any]    			=      True
							_lowercase					:  str    			=      99
							_lowercase					:  Optional[int]    			=      32
							_lowercase					:  int    			=      2
							_lowercase					:  Optional[int]    			=      4
							_lowercase					:  List[str]    			=      37
							_lowercase					:  Dict    			=      "gelu"
							_lowercase					:  str    			=      0.1
							_lowercase					:  Optional[int]    			=      0.1
							_lowercase					:  int    			=      512
							_lowercase					:  str    			=      16
							_lowercase					:  List[Any]    			=      False
							_lowercase					:  Dict    			=      -1
							_lowercase					:  Optional[Any]    			=      True
							_lowercase					:  Dict    			=      2
							_lowercase					:  Union[str, Any]    			=      0.02
							_lowercase					:  int    			=      3
							_lowercase					:  Tuple    			=      4
							_lowercase					:  Optional[Any]    			=      None






	def 			_a(self							:   List[str]						)   -> List[Any]:
							_lowercase					:  Optional[Any]    			=      ids_tensor([self.batch_size, self.seq_length]			,  self.vocab_size						)

							_lowercase					:  Optional[Any]    			=      None
							if self.use_input_mask:
													_lowercase					:  int    			=      random_attention_mask([self.batch_size, self.seq_length]						)

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

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

							_lowercase					:  Union[str, Any]    			=      DebertaConfig(
							    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			,  max_relative_positions=self.max_relative_positions			,  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 			_a(self							:   Dict			,  snake_case							:   Optional[Any]			,  snake_case							:   Optional[Any]			,  snake_case							:   List[Any]			,  snake_case							:   str			,  snake_case							:   Optional[int]			,  snake_case							:   List[Any]			,  snake_case							:   Union[str, Any]						)   -> str:
							_lowercase					:  Tuple    			=      TFDebertaModel(config=snake_case						)
							_lowercase					:  Any    			=      {"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}

							_lowercase					:  Tuple    			=      [input_ids, input_mask]
							_lowercase					:  Any    			=      model(snake_case						)

							_lowercase					:  Any    			=      model(snake_case						)

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






	def 			_a(self							:   int			,  snake_case							:   int			,  snake_case							:   Union[str, Any]			,  snake_case							:   Tuple			,  snake_case							:   List[Any]			,  snake_case							:   Any			,  snake_case							:   Union[str, Any]			,  snake_case							:   int						)   -> int:
							_lowercase					:  int    			=      TFDebertaForMaskedLM(config=snake_case						)
							_lowercase					:  List[Any]    			=      {
							    "input_ids": input_ids,
							    "attention_mask": input_mask,
							    "token_type_ids": token_type_ids,
							}
							_lowercase					:  int    			=      model(snake_case						)
							self.parent.assertEqual(result.logits.shape			,  (self.batch_size, self.seq_length, self.vocab_size)						)






	def 			_a(self							:   str			,  snake_case							:   Dict			,  snake_case							:   Optional[int]			,  snake_case							:   int			,  snake_case							:   Tuple			,  snake_case							:   int			,  snake_case							:   Any			,  snake_case							:   Any						)   -> List[str]:
							_lowercase					:  Dict    			=      self.num_labels
							_lowercase					:  Tuple    			=      TFDebertaForSequenceClassification(config=snake_case						)
							_lowercase					:  Optional[Any]    			=      {
							    "input_ids": input_ids,
							    "attention_mask": input_mask,
							    "token_type_ids": token_type_ids,
							}

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






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






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

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




@require_tf
class      __lowercase	(	__snake_case      ,   __snake_case      ,   unittest.TestCase					):
	_A   			=      (
	    (
	        TFDebertaModel,
	        TFDebertaForMaskedLM,
	        TFDebertaForQuestionAnswering,
	        TFDebertaForSequenceClassification,
	        TFDebertaForTokenClassification,
	    )
	    if is_tf_available()
	    else ()
	)
	_A   			=      (
	    {
	        "feature-extraction": TFDebertaModel,
	        "fill-mask": TFDebertaForMaskedLM,
	        "question-answering": TFDebertaForQuestionAnswering,
	        "text-classification": TFDebertaForSequenceClassification,
	        "token-classification": TFDebertaForTokenClassification,
	        "zero-shot": TFDebertaForSequenceClassification,
	    }
	    if is_tf_available()
	    else {}
	)

	_A   			=      False
	_A   			=      False






	def 			_a(self							:   int						)   -> List[Any]:
							_lowercase					:  List[str]    			=      TFDebertaModelTester(self						)
							_lowercase					:  Optional[int]    			=      ConfigTester(self			,  config_class=snake_case			,  hidden_size=37						)






	def 			_a(self							:   Any						)   -> Tuple:
							self.config_tester.run_common_tests()






	def 			_a(self							:   Optional[Any]						)   -> Dict:
							_lowercase					:  Union[str, Any]    			=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_model(*snake_case						)






	def 			_a(self							:   Optional[Any]						)   -> Any:
							_lowercase					:  Union[str, Any]    			=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_masked_lm(*snake_case						)






	def 			_a(self							:   str						)   -> int:
							_lowercase					:  int    			=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_question_answering(*snake_case						)






	def 			_a(self							:   Any						)   -> List[Any]:
							_lowercase					:  Any    			=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_sequence_classification(*snake_case						)






	def 			_a(self							:   Tuple						)   -> str:
							_lowercase					:  Union[str, Any]    			=      self.model_tester.prepare_config_and_inputs()
							self.model_tester.create_and_check_for_token_classification(*snake_case						)






	@slow
	def 			_a(self							:   Optional[Any]						)   -> int:
							_lowercase					:  Optional[int]    			=      TFDebertaModel.from_pretrained("kamalkraj/deberta-base"						)
							self.assertIsNotNone(snake_case						)




@require_tf
class      __lowercase	(	unittest.TestCase					):






	@unittest.skip(reason="Model not available yet"						)
	def 			_a(self							:   Optional[int]						)   -> int:
							pass






	@slow
	def 			_a(self							:   Optional[int]						)   -> Optional[int]:
							_lowercase					:  Optional[Any]    			=      TFDebertaModel.from_pretrained("kamalkraj/deberta-base"						)
							_lowercase					:  List[Any]    			=      tf.constant([[0, 3_1414, 232, 328, 740, 1140, 1_2695, 69, 4_6078, 1588, 2]]						)
							_lowercase					:  Union[str, Any]    			=      tf.constant([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]						)
							_lowercase					:  List[str]    			=      model(snake_case			,  attention_mask=snake_case						)[0]

							_lowercase					:  List[str]    			=      tf.constant(
							    [
							        [
							            [-0.59_85_58_96, -0.80_55_25_66, -0.8_46_21_35],
							            [1.4_48_40_25, -0.93_48_37_94, -0.80_59_30_85],
							            [0.3_12_27_41, 0.00_31_60_59, -1.4_13_13_77],
							        ]
							    ]						)
							tf.debugging.assert_near(output[:, 1:4, 1:4]			,  snake_case			,  atol=1e-4						)




