






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        SCREAMING_SNAKE_CASE	:
     '''simple docstring'''


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


     def  _A				( self				:		List[str]					):
       SCREAMING_SNAKE_CASE				:					Optional[Any]		  =			ids_tensor([self.batch_size, self.seq_length]    ,       self.vocab_size					)

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

       SCREAMING_SNAKE_CASE				:					List[str]		  =			None
       if self.use_token_type_ids:
         SCREAMING_SNAKE_CASE				:					Optional[int]		  =			ids_tensor([self.batch_size, self.seq_length]    ,       self.type_vocab_size					)

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

       SCREAMING_SNAKE_CASE				:					Optional[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=UpperCAmelCase_    ,       )

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


     def  _A				( self				:		List[str]    ,       UpperCAmelCase_				:		int    ,       UpperCAmelCase_				:		Dict    ,       UpperCAmelCase_				:		Dict    ,       UpperCAmelCase_				:		Dict    ,       UpperCAmelCase_				:		str    ,       UpperCAmelCase_				:		int    ,       UpperCAmelCase_				:		List[str]					):
       SCREAMING_SNAKE_CASE				:					Optional[int]		  =			TFDebertaModel(config=UpperCAmelCase_					)
       SCREAMING_SNAKE_CASE				:					Dict		  =			{"input_ids": input_ids, "attention_mask": input_mask, "token_type_ids": token_type_ids}

       SCREAMING_SNAKE_CASE				:					Any		  =			[input_ids, input_mask]
       SCREAMING_SNAKE_CASE				:					List[Any]		  =			model(UpperCAmelCase_					)

       SCREAMING_SNAKE_CASE				:					Optional[Any]		  =			model(UpperCAmelCase_					)

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


     def  _A				( self				:		Any    ,       UpperCAmelCase_				:		Optional[int]    ,       UpperCAmelCase_				:		Optional[int]    ,       UpperCAmelCase_				:		Any    ,       UpperCAmelCase_				:		str    ,       UpperCAmelCase_				:		Optional[Any]    ,       UpperCAmelCase_				:		Optional[Any]    ,       UpperCAmelCase_				:		Union[str, Any]					):
       SCREAMING_SNAKE_CASE				:					List[Any]		  =			TFDebertaForMaskedLM(config=UpperCAmelCase_					)
       SCREAMING_SNAKE_CASE				:					List[str]		  =			{
           "input_ids": input_ids,
           "attention_mask": input_mask,
           "token_type_ids": token_type_ids,
       }
       SCREAMING_SNAKE_CASE				:					Dict		  =			model(UpperCAmelCase_					)
       self.parent.assertEqual(result.logits.shape    ,       (self.batch_size, self.seq_length, self.vocab_size)					)


     def  _A				( self				:		List[str]    ,       UpperCAmelCase_				:		Tuple    ,       UpperCAmelCase_				:		List[str]    ,       UpperCAmelCase_				:		List[Any]    ,       UpperCAmelCase_				:		Tuple    ,       UpperCAmelCase_				:		Optional[Any]    ,       UpperCAmelCase_				:		Optional[Any]    ,       UpperCAmelCase_				:		Optional[Any]					):
       SCREAMING_SNAKE_CASE				:					Tuple		  =			self.num_labels
       SCREAMING_SNAKE_CASE				:					Union[str, Any]		  =			TFDebertaForSequenceClassification(config=UpperCAmelCase_					)
       SCREAMING_SNAKE_CASE				:					Dict		  =			{
           "input_ids": input_ids,
           "attention_mask": input_mask,
           "token_type_ids": token_type_ids,
       }

       SCREAMING_SNAKE_CASE				:					Any		  =			model(UpperCAmelCase_					)
       self.parent.assertEqual(result.logits.shape    ,       (self.batch_size, self.num_labels)					)


     def  _A				( self				:		str    ,       UpperCAmelCase_				:		Optional[Any]    ,       UpperCAmelCase_				:		Any    ,       UpperCAmelCase_				:		Any    ,       UpperCAmelCase_				:		Optional[int]    ,       UpperCAmelCase_				:		List[Any]    ,       UpperCAmelCase_				:		Dict    ,       UpperCAmelCase_				:		Optional[Any]					):
       SCREAMING_SNAKE_CASE				:					str		  =			self.num_labels
       SCREAMING_SNAKE_CASE				:					str		  =			TFDebertaForTokenClassification(config=UpperCAmelCase_					)
       SCREAMING_SNAKE_CASE				:					List[Any]		  =			{
           "input_ids": input_ids,
           "attention_mask": input_mask,
           "token_type_ids": token_type_ids,
       }
       SCREAMING_SNAKE_CASE				:					Tuple		  =			model(UpperCAmelCase_					)
       self.parent.assertEqual(result.logits.shape    ,       (self.batch_size, self.seq_length, self.num_labels)					)


     def  _A				( self				:		int    ,       UpperCAmelCase_				:		List[Any]    ,       UpperCAmelCase_				:		str    ,       UpperCAmelCase_				:		str    ,       UpperCAmelCase_				:		Optional[Any]    ,       UpperCAmelCase_				:		Tuple    ,       UpperCAmelCase_				:		Optional[Any]    ,       UpperCAmelCase_				:		Dict					):
       SCREAMING_SNAKE_CASE				:					Any		  =			TFDebertaForQuestionAnswering(config=UpperCAmelCase_					)
       SCREAMING_SNAKE_CASE				:					Any		  =			{
           "input_ids": input_ids,
           "attention_mask": input_mask,
           "token_type_ids": token_type_ids,
       }

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





@require_tf
class        SCREAMING_SNAKE_CASE	(	lowerCAmelCase					,						lowerCAmelCase					,						unittest.TestCase    ):
     '''simple docstring'''


     UpperCamelCase_							:						int								=		(
         (
             TFDebertaModel,
             TFDebertaForMaskedLM,
             TFDebertaForQuestionAnswering,
             TFDebertaForSequenceClassification,
             TFDebertaForTokenClassification,
         )
         if is_tf_available()
         else ()
     )
     UpperCamelCase_							:						Any								=		(
         {
             '''feature-extraction''': TFDebertaModel,
             '''fill-mask''': TFDebertaForMaskedLM,
             '''question-answering''': TFDebertaForQuestionAnswering,
             '''text-classification''': TFDebertaForSequenceClassification,
             '''token-classification''': TFDebertaForTokenClassification,
             '''zero-shot''': TFDebertaForSequenceClassification,
         }
         if is_tf_available()
         else {}
     )

     UpperCamelCase_							:						int								=		False
     UpperCamelCase_							:						Any								=		False


     def  _A				( self				:		str					):
       SCREAMING_SNAKE_CASE				:					str		  =			TFDebertaModelTester(self					)
       SCREAMING_SNAKE_CASE				:					List[str]		  =			ConfigTester(self    ,       config_class=UpperCAmelCase_    ,       hidden_size=37					)


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


     def  _A				( self				:		List[str]					):
       SCREAMING_SNAKE_CASE				:					Union[str, Any]		  =			self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_model(*UpperCAmelCase_					)


     def  _A				( self				:		Optional[int]					):
       SCREAMING_SNAKE_CASE				:					Tuple		  =			self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_masked_lm(*UpperCAmelCase_					)


     def  _A				( self				:		str					):
       SCREAMING_SNAKE_CASE				:					Union[str, Any]		  =			self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_question_answering(*UpperCAmelCase_					)


     def  _A				( self				:		Optional[int]					):
       SCREAMING_SNAKE_CASE				:					Any		  =			self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_sequence_classification(*UpperCAmelCase_					)


     def  _A				( self				:		Union[str, Any]					):
       SCREAMING_SNAKE_CASE				:					Dict		  =			self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_for_token_classification(*UpperCAmelCase_					)






     @slow
     def  _A				( self				:		Union[str, Any]					):
       SCREAMING_SNAKE_CASE				:					str		  =			TFDebertaModel.from_pretrained("kamalkraj/deberta-base"					)
       self.assertIsNotNone(UpperCAmelCase_					)





@require_tf
class        SCREAMING_SNAKE_CASE	(	unittest.TestCase    ):
     '''simple docstring'''


     @unittest.skip(reason="Model not available yet"					)
     def  _A				( self				:		List[Any]					):
       pass






     @slow
     def  _A				( self				:		Optional[Any]					):
       SCREAMING_SNAKE_CASE				:					int		  =			TFDebertaModel.from_pretrained("kamalkraj/deberta-base"					)
       SCREAMING_SNAKE_CASE				:					Optional[int]		  =			tf.constant([[0, 3_1414, 232, 328, 740, 1140, 1_2695, 69, 4_6078, 1588, 2]]					)
       SCREAMING_SNAKE_CASE				:					Any		  =			tf.constant([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]					)
       SCREAMING_SNAKE_CASE				:					Tuple		  =			model(UpperCAmelCase_    ,       attention_mask=UpperCAmelCase_					)[0]

       SCREAMING_SNAKE_CASE				:					Optional[Any]		  =			tf.constant(
           [
               [
                   [-0.59_855_896, -0.80_552_566, -0.8_462_135],
                   [1.4_484_025, -0.93_483_794, -0.80_593_085],
                   [0.3_122_741, 0.00_316_059, -1.4_131_377],
               ]
           ]					)
       tf.debugging.assert_near(output[:, 1:4, 1:4]    ,       UpperCAmelCase_    ,       atol=1E-4					)














import unittest

from transformers import SpeechaTextaConfig
from transformers.testing_utils import is_torch_available, require_torch, torch_device

from ...generation.test_utils import GenerationTesterMixin
from ...test_configuration_common import ConfigTester
from ...test_modeling_common import ModelTesterMixin, ids_tensor
from ...test_pipeline_mixin import PipelineTesterMixin


if is_torch_available():
   import torch

   from transformers.models.speech_to_text_a.modeling_speech_to_text_a import (
       SpeechaTextaDecoder,
       SpeechaTextaForCausalLM,
   )


@require_torch
class        SCREAMING_SNAKE_CASE	:
     '''simple docstring'''


     def __init__( self				:		List[str]    ,       UpperCAmelCase_				:		Any    ,       UpperCAmelCase_				:		List[Any]=99    ,       UpperCAmelCase_				:		Tuple=13    ,       UpperCAmelCase_				:		Dict=16    ,       UpperCAmelCase_				:		int=7    ,       UpperCAmelCase_				:		Optional[Any]=True    ,       UpperCAmelCase_				:		List[Any]=True    ,       UpperCAmelCase_				:		Any=True    ,       UpperCAmelCase_				:		List[str]=False    ,       UpperCAmelCase_				:		Tuple=True    ,       UpperCAmelCase_				:		Tuple=2    ,       UpperCAmelCase_				:		List[str]=32    ,       UpperCAmelCase_				:		Union[str, Any]=4    ,       UpperCAmelCase_				:		Any=4    ,       UpperCAmelCase_				:		Optional[int]=30    ,       UpperCAmelCase_				:		Union[str, Any]=0    ,       UpperCAmelCase_				:		Union[str, Any]=1    ,       UpperCAmelCase_				:		Any=2    ,       UpperCAmelCase_				:		Dict=None    ,       ):
       SCREAMING_SNAKE_CASE				:					Any		  =			parent
       SCREAMING_SNAKE_CASE				:					Tuple		  =			batch_size
       SCREAMING_SNAKE_CASE				:					str		  =			decoder_seq_length
       # For common tests
       SCREAMING_SNAKE_CASE				:					Tuple		  =			self.decoder_seq_length
       SCREAMING_SNAKE_CASE				:					str		  =			is_training
       SCREAMING_SNAKE_CASE				:					Dict		  =			use_attention_mask
       SCREAMING_SNAKE_CASE				:					int		  =			use_labels

       SCREAMING_SNAKE_CASE				:					Tuple		  =			vocab_size
       SCREAMING_SNAKE_CASE				:					int		  =			d_model
       SCREAMING_SNAKE_CASE				:					List[str]		  =			d_model
       SCREAMING_SNAKE_CASE				:					int		  =			decoder_layers
       SCREAMING_SNAKE_CASE				:					List[Any]		  =			decoder_layers
       SCREAMING_SNAKE_CASE				:					List[Any]		  =			decoder_ffn_dim
       SCREAMING_SNAKE_CASE				:					Tuple		  =			decoder_attention_heads
       SCREAMING_SNAKE_CASE				:					Dict		  =			decoder_attention_heads
       SCREAMING_SNAKE_CASE				:					Optional[int]		  =			eos_token_id
       SCREAMING_SNAKE_CASE				:					List[Any]		  =			bos_token_id
       SCREAMING_SNAKE_CASE				:					List[Any]		  =			pad_token_id
       SCREAMING_SNAKE_CASE				:					List[str]		  =			decoder_start_token_id
       SCREAMING_SNAKE_CASE				:					List[Any]		  =			use_cache
       SCREAMING_SNAKE_CASE				:					Tuple		  =			max_position_embeddings

       SCREAMING_SNAKE_CASE				:					Any		  =			None
       SCREAMING_SNAKE_CASE				:					Tuple		  =			decoder_seq_length
       SCREAMING_SNAKE_CASE				:					int		  =			2
       SCREAMING_SNAKE_CASE				:					Optional[Any]		  =			1


     def  _A				( self				:		Optional[int]					):
       SCREAMING_SNAKE_CASE				:					Optional[Any]		  =			ids_tensor([self.batch_size, self.decoder_seq_length]    ,       self.vocab_size					)

       SCREAMING_SNAKE_CASE				:					str		  =			None
       if self.use_attention_mask:
         SCREAMING_SNAKE_CASE				:					Tuple		  =			ids_tensor([self.batch_size, self.decoder_seq_length]    ,       vocab_size=2					)

       SCREAMING_SNAKE_CASE				:					str		  =			None
       if self.use_labels:
         SCREAMING_SNAKE_CASE				:					List[str]		  =			ids_tensor([self.batch_size, self.decoder_seq_length]    ,       self.vocab_size					)

       SCREAMING_SNAKE_CASE				:					str		  =			SpeechaTextaConfig(
           vocab_size=self.vocab_size    ,       d_model=self.d_model    ,       decoder_layers=self.decoder_layers    ,       decoder_ffn_dim=self.decoder_ffn_dim    ,       decoder_attention_heads=self.decoder_attention_heads    ,       eos_token_id=self.eos_token_id    ,       bos_token_id=self.bos_token_id    ,       use_cache=self.use_cache    ,       pad_token_id=self.pad_token_id    ,       decoder_start_token_id=self.decoder_start_token_id    ,       max_position_embeddings=self.max_position_embeddings    ,       )

       return (
           config,
           input_ids,
           attention_mask,
           lm_labels,
       )


     def  _A				( self				:		Optional[Any]    ,       UpperCAmelCase_				:		int    ,       UpperCAmelCase_				:		Dict    ,       UpperCAmelCase_				:		int    ,       UpperCAmelCase_				:		Any    ,       ):
       SCREAMING_SNAKE_CASE				:					str		  =			True
       SCREAMING_SNAKE_CASE				:					Optional[int]		  =			SpeechaTextaDecoder(config=UpperCAmelCase_					).to(UpperCAmelCase_					).eval()
       SCREAMING_SNAKE_CASE				:					Tuple		  =			input_ids[:2]

       input_ids[input_ids == 0] += 1
       # first forward pass
       SCREAMING_SNAKE_CASE				:					Union[str, Any]		  =			model(UpperCAmelCase_    ,       use_cache=UpperCAmelCase_					)
       SCREAMING_SNAKE_CASE				:					List[str]		  =			model(UpperCAmelCase_					)
       SCREAMING_SNAKE_CASE				:					Union[str, Any]		  =			model(UpperCAmelCase_    ,       use_cache=UpperCAmelCase_					)

       self.parent.assertTrue(len(UpperCAmelCase_					) == len(UpperCAmelCase_					)					)
       self.parent.assertTrue(len(UpperCAmelCase_					) == len(UpperCAmelCase_					) + 1					)

       SCREAMING_SNAKE_CASE				:					List[Any]		  =			outputs["past_key_values"]

       # create hypothetical next token and extent to next_input_ids
       SCREAMING_SNAKE_CASE				:					str		  =			ids_tensor((2, 1)    ,       config.vocab_size - 1					) + 1

       # append to next input_ids and
       SCREAMING_SNAKE_CASE				:					str		  =			torch.cat([input_ids, next_tokens]    ,       dim=-1					)

       print(UpperCAmelCase_					)

       SCREAMING_SNAKE_CASE				:					List[str]		  =			model(UpperCAmelCase_					)["last_hidden_state"]
       SCREAMING_SNAKE_CASE				:					Union[str, Any]		  =			model(UpperCAmelCase_    ,       past_key_values=UpperCAmelCase_					)["last_hidden_state"]

       # select random slice
       SCREAMING_SNAKE_CASE				:					List[Any]		  =			ids_tensor((1,)    ,       output_from_past.shape[-1]					).item()
       SCREAMING_SNAKE_CASE				:					str		  =			output_from_no_past[:, next_input_ids.shape[-1] - 1, random_slice_idx].detach()
       SCREAMING_SNAKE_CASE				:					int		  =			output_from_past[:, 0, random_slice_idx].detach()

       # test that outputs are equal for slice
       assert torch.allclose(UpperCAmelCase_    ,       UpperCAmelCase_    ,       atol=1E-3					)






     def  _A				( self				:		str					):
       SCREAMING_SNAKE_CASE				:					int		  =			self.prepare_config_and_inputs()
       (
           (
           SCREAMING_SNAKE_CASE
       )  ,     (
           SCREAMING_SNAKE_CASE
       )  ,     (
           SCREAMING_SNAKE_CASE
       )  ,     (
           SCREAMING_SNAKE_CASE
       )  ,     
       )				:					Optional[Any]		  =			config_and_inputs

       SCREAMING_SNAKE_CASE				:					Optional[Any]		  =			{
           "input_ids": input_ids,
           "attention_mask": attention_mask,
       }
       return config, inputs_dict





@require_torch
class        SCREAMING_SNAKE_CASE	(	lowerCAmelCase					,						lowerCAmelCase					,						lowerCAmelCase					,						unittest.TestCase    ):
     '''simple docstring'''


     UpperCamelCase_							:						int								=		(SpeechaTextaDecoder, SpeechaTextaForCausalLM) if is_torch_available() else ()
     UpperCamelCase_							:						Tuple								=		(SpeechaTextaForCausalLM,) if is_torch_available() else ()
     UpperCamelCase_							:						int								=		{'''text-generation''': SpeechaTextaForCausalLM} if is_torch_available() else {}
     UpperCamelCase_							:						Tuple								=		True
     UpperCamelCase_							:						Union[str, Any]								=		False


     def  _A				( self				:		Tuple    ,       ):
       SCREAMING_SNAKE_CASE				:					Any		  =			SpeechaTextaStandaloneDecoderModelTester(self    ,       is_training=UpperCAmelCase_					)
       SCREAMING_SNAKE_CASE				:					Optional[int]		  =			ConfigTester(self    ,       config_class=UpperCAmelCase_					)


     def  _A				( self				:		Optional[Any]					):
       pass


     def  _A				( self				:		str					):
       pass


     def  _A				( self				:		Dict					):
       pass


     def  _A				( self				:		Optional[Any]					):
       self.config_tester.run_common_tests()


     def  _A				( self				:		Optional[int]					):
       SCREAMING_SNAKE_CASE				:					List[Any]		  =			self.model_tester.prepare_config_and_inputs()
       self.model_tester.create_and_check_decoder_model_past(*UpperCAmelCase_					)






     def  _A				( self				:		Optional[int]					):
       return






