code: 
  import tempfile
  import unittest
  
  import numpy as np
  
  import transformers
  from transformers import GPTaTokenizer, GPTNeoConfig, is_flax_available, is_torch_available
  from transformers.testing_utils import is_pt_flax_cross_test, require_flax, slow
  
  from ...generation.test_flax_utils import FlaxGenerationTesterMixin
  from ...test_modeling_flax_common import FlaxModelTesterMixin, ids_tensor, random_attention_mask
  
  
  if is_flax_available():
  							import jax
  							import jax.numpy as jnp
  
  							from transformers.modeling_flax_pytorch_utils import (
  							    convert_pytorch_state_dict_to_flax,
  							    load_flax_weights_in_pytorch_model,
  							)
  							from transformers.models.gpt_neo.modeling_flax_gpt_neo import FlaxGPTNeoForCausalLM, FlaxGPTNeoModel
  
  if is_torch_available():
  							import torch
  
  
  
  
  class      __lowercase	:
  
  
  
  
  
  
  	def __init__(self							:   Optional[Any]			,  snake_case							:   Optional[Any]			,  snake_case							:   Dict=14			,  snake_case							:   str=7			,  snake_case							:   int=True			,  snake_case							:   Tuple=True			,  snake_case							:   Optional[Any]=False			,  snake_case							:   Any=True			,  snake_case							:   Tuple=99			,  snake_case							:   List[Any]=32			,  snake_case							:   Union[str, Any]=4			,  snake_case							:   str=4			,  snake_case							:   Optional[int]=[[["global", "local"], 2]]			,  snake_case							:   Optional[Any]=37			,  snake_case							:   str="gelu"			,  snake_case							:   List[Any]=0.1			,  snake_case							:   Tuple=0.1			,  snake_case							:   str=512			,  snake_case							:   str=7			,  snake_case							:   Tuple=0.02			,  )   -> List[Any]:
  							_lowercase					:  Tuple    			=      parent
  							_lowercase					:  int    			=      batch_size
  							_lowercase					:  Union[str, Any]    			=      seq_length
  							_lowercase					:  Optional[int]    			=      is_training
  							_lowercase					:  Any    			=      use_input_mask
  							_lowercase					:  List[Any]    			=      use_token_type_ids
  							_lowercase					:  List[Any]    			=      use_labels
  							_lowercase					:  Tuple    			=      vocab_size
  							_lowercase					:  Dict    			=      hidden_size
  							_lowercase					:  str    			=      num_hidden_layers
  							_lowercase					:  Any    			=      num_attention_heads
  							_lowercase					:  int    			=      attention_types
  							_lowercase					:  Tuple    			=      intermediate_size
  							_lowercase					:  Optional[Any]    			=      hidden_act
  							_lowercase					:  Dict    			=      hidden_dropout_prob
  							_lowercase					:  List[Any]    			=      attention_probs_dropout_prob
  							_lowercase					:  List[str]    			=      max_position_embeddings
  							_lowercase					:  Any    			=      window_size
  							_lowercase					:  Tuple    			=      initializer_range
  							_lowercase					:  List[str]    			=      None
  							_lowercase					:  List[Any]    			=      vocab_size - 1
  							_lowercase					:  Dict    			=      vocab_size - 1
  							_lowercase					:  Dict    			=      vocab_size - 1
  
  
  
  
  
  
  	def 			_a(self							:   Dict						)   -> List[str]:
  							_lowercase					:  Optional[Any]    			=      ids_tensor([self.batch_size, self.seq_length]			,  self.vocab_size						)
  
  							_lowercase					:  List[Any]    			=      None
  							if self.use_input_mask:
  													_lowercase					:  Tuple    			=      random_attention_mask([self.batch_size, self.seq_length]						)
  
  							_lowercase					:  Dict    			=      GPTNeoConfig(
  							    vocab_size=self.vocab_size			,  hidden_size=self.hidden_size			,  num_layers=self.num_hidden_layers			,  num_heads=self.num_attention_heads			,  max_position_embeddings=self.max_position_embeddings			,  use_cache=snake_case			,  bos_token_id=self.bos_token_id			,  eos_token_id=self.eos_token_id			,  pad_token_id=self.pad_token_id			,  window_size=self.window_size			,  attention_types=self.attention_types			,  )
  
  							return (config, input_ids, input_mask)
  
  
  
  
  
  
  	def 			_a(self							:   Dict						)   -> Any:
  							_lowercase					:  Optional[int]    			=      self.prepare_config_and_inputs()
  							_lowercase			,						_lowercase			,						_lowercase					:  Any    			=      config_and_inputs
  							_lowercase					:  Tuple    			=      {"input_ids": input_ids, "attention_mask": attention_mask}
  							return config, inputs_dict
  
  
  
  
  
  
  	def 			_a(self							:   Tuple			,  snake_case							:   Dict			,  snake_case							:   Optional[Any]			,  snake_case							:   str			,  snake_case							:   int						)   -> List[Any]:
  							_lowercase					:  str    			=      20
  							_lowercase					:  Dict    			=      model_class_name(snake_case						)
  
  							_lowercase					:  Dict    			=      model.init_cache(input_ids.shape[0]			,  snake_case						)
  							_lowercase					:  Tuple    			=      jnp.ones((input_ids.shape[0], max_decoder_length)			,  dtype="i4"						)
  
  							_lowercase					:  List[Any]    			=      jnp.broadcast_to(
  							    jnp.arange(input_ids.shape[-1] - 1						)[None, :]			,  (input_ids.shape[0], input_ids.shape[-1] - 1)						)
  							_lowercase					:  Optional[int]    			=      model(
  							    input_ids[:, :-1]			,  attention_mask=snake_case			,  past_key_values=snake_case			,  position_ids=snake_case			,  )
  
  							_lowercase					:  Union[str, Any]    			=      jnp.array(input_ids.shape[0] * [[input_ids.shape[-1] - 1]]			,  dtype="i4"						)
  							_lowercase					:  Optional[int]    			=      model(
  							    input_ids[:, -1:]			,  attention_mask=snake_case			,  past_key_values=outputs_cache.past_key_values			,  position_ids=snake_case			,  )
  
  							_lowercase					:  Dict    			=      model(snake_case						)
  
  							_lowercase					:  Union[str, Any]    			=      np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])						)						)
  							self.parent.assertTrue(diff < 1e-3			,  msg=F"""Max diff is {diff}"""						)
  
  
  
  
  
  
  	def 			_a(self							:   List[str]			,  snake_case							:   Optional[Any]			,  snake_case							:   str			,  snake_case							:   Union[str, Any]			,  snake_case							:   Any						)   -> List[str]:
  							_lowercase					:  Dict    			=      20
  							_lowercase					:  int    			=      model_class_name(snake_case						)
  
  							_lowercase					:  int    			=      jnp.concatenate(
  							    [attention_mask, jnp.zeros((attention_mask.shape[0], max_decoder_length - attention_mask.shape[1])						)]			,  axis=-1			,  )
  
  							_lowercase					:  Dict    			=      model.init_cache(input_ids.shape[0]			,  snake_case						)
  							_lowercase					:  Union[str, Any]    			=      jnp.broadcast_to(
  							    jnp.arange(input_ids.shape[-1] - 1						)[None, :]			,  (input_ids.shape[0], input_ids.shape[-1] - 1)						)
  
  							_lowercase					:  List[str]    			=      model(
  							    input_ids[:, :-1]			,  attention_mask=snake_case			,  past_key_values=snake_case			,  position_ids=snake_case			,  )
  							_lowercase					:  Any    			=      jnp.array(input_ids.shape[0] * [[input_ids.shape[-1] - 1]]			,  dtype="i4"						)
  							_lowercase					:  str    			=      model(
  							    input_ids[:, -1:]			,  past_key_values=outputs_cache.past_key_values			,  attention_mask=snake_case			,  position_ids=snake_case			,  )
  
  							_lowercase					:  List[Any]    			=      model(snake_case			,  attention_mask=snake_case						)
  
  							_lowercase					:  Optional[Any]    			=      np.max(np.abs((outputs_cache_next[0][:, -1, :5] - outputs[0][:, -1, :5])						)						)
  							self.parent.assertTrue(diff < 1e-3			,  msg=F"""Max diff is {diff}"""						)
  
  
  
  
  @require_flax
  class      __lowercase	(	__snake_case      ,   __snake_case      ,   unittest.TestCase					):
  	_A   			=      (FlaxGPTNeoModel, FlaxGPTNeoForCausalLM) if is_flax_available() else ()
  	_A   			=      (FlaxGPTNeoForCausalLM,) if is_flax_available() else ()
  
  
  
  
  
  
  	def 			_a(self							:   Dict						)   -> Optional[int]:
  							_lowercase					:  Optional[int]    			=      FlaxGPTNeoModelTester(self						)
  
  
  
  
  
  
  	def 			_a(self							:   Union[str, Any]						)   -> Dict:
  							for model_class_name in self.all_model_classes:
  													_lowercase			,						_lowercase			,						_lowercase					:  List[Any]    			=      self.model_tester.prepare_config_and_inputs()
  													self.model_tester.check_use_cache_forward(snake_case			,  snake_case			,  snake_case			,  snake_case						)
  
  
  
  
  
  
  	def 			_a(self							:   List[str]						)   -> Optional[Any]:
  							for model_class_name in self.all_model_classes:
  													_lowercase			,						_lowercase			,						_lowercase					:  Optional[Any]    			=      self.model_tester.prepare_config_and_inputs()
  													self.model_tester.check_use_cache_forward_with_attn_mask(
  													    snake_case			,  snake_case			,  snake_case			,  snake_case						)
  
  
  
  
  
  
  	@slow
  	def 			_a(self							:   List[str]						)   -> Union[str, Any]:
  							_lowercase					:  Any    			=      GPTaTokenizer.from_pretrained("gpt2"			,  pad_token="<|endoftext|>"			,  padding_side="left"						)
  							_lowercase					:  Union[str, Any]    			=      tokenizer(["Hello this is a long string", "Hey"]			,  return_tensors="np"			,  padding=snake_case			,  truncation=snake_case						)
  
  							_lowercase					:  Any    			=      FlaxGPTNeoForCausalLM.from_pretrained("EleutherAI/gpt-neo-125M"						)
  							_lowercase					:  Union[str, Any]    			=      False
  							_lowercase					:  List[str]    			=      model.config.eos_token_id
  
  							_lowercase					:  int    			=      jax.jit(model.generate						)
  
  							_lowercase					:  List[str]    			=      jit_generate(
  							    inputs["input_ids"]			,  attention_mask=inputs["attention_mask"]			,  pad_token_id=tokenizer.pad_token_id						).sequences
  
  							_lowercase					:  Optional[int]    			=      tokenizer.batch_decode(snake_case			,  skip_special_tokens=snake_case						)
  
  							_lowercase					:  List[str]    			=      [
  							    "Hello this is a long string of text.\n\nI'm trying to get the text of the",
  							    "Hey, I'm a little late to the party. I'm going to",
  							]
  
  							self.assertListEqual(snake_case			,  snake_case						)
  
  
  
  
  
  
  	@is_pt_flax_cross_test
  	def 			_a(self							:   Optional[int]						)   -> str:
  							_lowercase			,						_lowercase					:  int    			=      self.model_tester.prepare_config_and_inputs_for_common()
  
  							for model_class in self.all_model_classes:
  													with self.subTest(model_class.__name__						):
  																			# prepare inputs
  																			_lowercase					:  int    			=      self._prepare_for_class(snake_case			,  snake_case						)
  																			_lowercase					:  Optional[int]    			=      {k: torch.tensor(v.tolist()						) for k, v in prepared_inputs_dict.items()}
  
  																			# load corresponding PyTorch class
  																			_lowercase					:  str    			=      model_class.__name__[4:]  # Skip the "Flax" at the beginning
  																			_lowercase					:  int    			=      getattr(snake_case			,  snake_case						)
  
  																			_lowercase			,						_lowercase					:  Dict    			=      pt_inputs["input_ids"].shape
  																			_lowercase					:  Any    			=      np.random.randint(0			,  seq_length - 1			,  size=(batch_size,)						)
  																			for batch_idx, start_index in enumerate(snake_case						):
  																									_lowercase					:  List[Any]    			=      0
  																									_lowercase					:  List[str]    			=      1
  																									_lowercase					:  Union[str, Any]    			=      0
  																									_lowercase					:  int    			=      1
  																			_lowercase					:  Tuple    			=      pt_model_class(snake_case						).eval()
  																			_lowercase					:  Union[str, Any]    			=      model_class(snake_case			,  dtype=jnp.floataa						)
  
  																			_lowercase					:  int    			=      convert_pytorch_state_dict_to_flax(pt_model.state_dict()			,  snake_case						)
  																			_lowercase					:  Optional[int]    			=      fx_state
  
  																			with torch.no_grad():
  																									_lowercase					:  int    			=      pt_model(**snake_case						).to_tuple()
  
  																			_lowercase					:  str    			=      fx_model(**snake_case						).to_tuple()
  																			self.assertEqual(len(snake_case						)			,  len(snake_case						)			,  "Output lengths differ between Flax and PyTorch"						)
  																			for fx_output, pt_output in zip(snake_case			,  snake_case						):
  																									self.assert_almost_equals(fx_output[:, -1]			,  pt_output[:, -1].numpy()			,  4e-2						)
  
  																			with tempfile.TemporaryDirectory() as tmpdirname:
  																									pt_model.save_pretrained(snake_case						)
  																									_lowercase					:  List[Any]    			=      model_class.from_pretrained(snake_case			,  from_pt=snake_case						)
  
  																			_lowercase					:  Tuple    			=      fx_model_loaded(**snake_case						).to_tuple()
  																			self.assertEqual(
  																			    len(snake_case						)			,  len(snake_case						)			,  "Output lengths differ between Flax and PyTorch"						)
  																			for fx_output_loaded, pt_output in zip(snake_case			,  snake_case						):
  																									self.assert_almost_equals(fx_output_loaded[:, -1]			,  pt_output[:, -1].numpy()			,  4e-2						)
  
  
  
  
  
  
  	@is_pt_flax_cross_test
  	def 			_a(self							:   Optional[int]						)   -> Any:
  							_lowercase			,						_lowercase					:  int    			=      self.model_tester.prepare_config_and_inputs_for_common()
  							for model_class in self.all_model_classes:
  													with self.subTest(model_class.__name__						):
  																			# prepare inputs
  																			_lowercase					:  Optional[Any]    			=      self._prepare_for_class(snake_case			,  snake_case						)
  																			_lowercase					:  Tuple    			=      {k: torch.tensor(v.tolist()						) for k, v in prepared_inputs_dict.items()}
  
  																			# load corresponding PyTorch class
  																			_lowercase					:  str    			=      model_class.__name__[4:]  # Skip the "Flax" at the beginning
  																			_lowercase					:  Tuple    			=      getattr(snake_case			,  snake_case						)
  
  																			_lowercase					:  int    			=      pt_model_class(snake_case						).eval()
  																			_lowercase					:  Optional[int]    			=      model_class(snake_case			,  dtype=jnp.floataa						)
  
  																			_lowercase					:  List[str]    			=      load_flax_weights_in_pytorch_model(snake_case			,  fx_model.params						)
  																			_lowercase			,						_lowercase					:  Union[str, Any]    			=      pt_inputs["input_ids"].shape
  																			_lowercase					:  Dict    			=      np.random.randint(0			,  seq_length - 1			,  size=(batch_size,)						)
  																			for batch_idx, start_index in enumerate(snake_case						):
  																									_lowercase					:  Optional[int]    			=      0
  																									_lowercase					:  List[str]    			=      1
  																									_lowercase					:  str    			=      0
  																									_lowercase					:  Optional[int]    			=      1
  
  																			# make sure weights are tied in PyTorch
  																			pt_model.tie_weights()
  
  																			with torch.no_grad():
  																									_lowercase					:  Optional[Any]    			=      pt_model(**snake_case						).to_tuple()
  
  																			_lowercase					:  Union[str, Any]    			=      fx_model(**snake_case						).to_tuple()
  																			self.assertEqual(len(snake_case						)			,  len(snake_case						)			,  "Output lengths differ between Flax and PyTorch"						)
  																			for fx_output, pt_output in zip(snake_case			,  snake_case						):
  																									self.assert_almost_equals(fx_output[:, -1]			,  pt_output[:, -1].numpy()			,  4e-2						)
  
  																			with tempfile.TemporaryDirectory() as tmpdirname:
  																									fx_model.save_pretrained(snake_case						)
  																									_lowercase					:  Tuple    			=      pt_model_class.from_pretrained(snake_case			,  from_flax=snake_case						)
  
  																			with torch.no_grad():
  																									_lowercase					:  Optional[Any]    			=      pt_model_loaded(**snake_case						).to_tuple()
  
  																			self.assertEqual(
  																			    len(snake_case						)			,  len(snake_case						)			,  "Output lengths differ between Flax and PyTorch"						)
  																			for fx_output, pt_output in zip(snake_case			,  snake_case						):
  																									self.assert_almost_equals(fx_output[:, -1]			,  pt_output[:, -1].numpy()			,  4e-2						)
  
  
  
  
  
  
  	@slow
  	def 			_a(self							:   Tuple						)   -> Any:
  							for model_class_name in self.all_model_classes:
  													_lowercase					:  List[Any]    			=      model_class_name.from_pretrained("EleutherAI/gpt-neo-125M"						)
  													_lowercase					:  List[str]    			=      model(np.ones((1, 1)						)						)
  													self.assertIsNotNone(snake_case						)
  
  
  
  
  
style_context: 
  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						)
  
  
  
  
  