




'''simple docstring'''







import json
import os
from typing import Optional, Tuple

import regex as re

from ...tokenization_utils import PreTrainedTokenizer
from ...utils import logging


lowercase      :   Tuple      =       logging.get_logger(__name__)

lowercase      :   Dict      =       {
    '''vocab_file''': '''vocab.json''',
    '''merges_file''': '''merges.txt''',
}

lowercase      :   Dict      =       {
    '''vocab_file''': {'''ctrl''': '''https://raw.githubusercontent.com/salesforce/ctrl/master/ctrl-vocab.json'''},
    '''merges_file''': {'''ctrl''': '''https://raw.githubusercontent.com/salesforce/ctrl/master/ctrl-merges.txt'''},
}

lowercase      :   List[str]      =       {
    '''ctrl''': 256,
}

lowercase      :   List[str]      =       {
    '''Pregnancy''': 16_8629,
    '''Christianity''': 7675,
    '''Explain''': 10_6423,
    '''Fitness''': 6_3440,
    '''Saving''': 6_3163,
    '''Ask''': 2_7171,
    '''Ass''': 9_5985,
    '''Joke''': 16_3509,
    '''Questions''': 4_5622,
    '''Thoughts''': 4_9605,
    '''Retail''': 5_2342,
    '''Feminism''': 16_4338,
    '''Writing''': 1_1992,
    '''Atheism''': 19_2263,
    '''Netflix''': 4_8616,
    '''Computing''': 3_9639,
    '''Opinion''': 4_3213,
    '''Alone''': 4_4967,
    '''Funny''': 5_8917,
    '''Gaming''': 4_0358,
    '''Human''': 4088,
    '''India''': 1331,
    '''Joker''': 7_7138,
    '''Diet''': 3_6206,
    '''Legal''': 1_1859,
    '''Norman''': 4939,
    '''Tip''': 7_2689,
    '''Weight''': 5_2343,
    '''Movies''': 4_6273,
    '''Running''': 2_3425,
    '''Science''': 2090,
    '''Horror''': 3_7793,
    '''Confession''': 6_0572,
    '''Finance''': 1_2250,
    '''Politics''': 1_6360,
    '''Scary''': 19_1985,
    '''Support''': 1_2654,
    '''Technologies''': 3_2516,
    '''Teenage''': 6_6160,
    '''Event''': 3_2769,
    '''Learned''': 6_7460,
    '''Notion''': 18_2770,
    '''Wikipedia''': 3_7583,
    '''Books''': 6665,
    '''Extract''': 7_6050,
    '''Confessions''': 10_2701,
    '''Conspiracy''': 7_5932,
    '''Links''': 6_3674,
    '''Narcissus''': 15_0425,
    '''Relationship''': 5_4766,
    '''Relationships''': 13_4796,
    '''Reviews''': 4_1671,
    '''News''': 4256,
    '''Translation''': 2_6820,
    '''multilingual''': 12_8406,
}



def        lowerCamelCase__				(      __lowercase				):
     snake_case			:      Optional[int]        =			set()
     snake_case			:      Any        =			word[0]
     for char in word[1:]:
          pairs.add((prev_char, char)				)
          snake_case			:      Any        =			char

     snake_case			:      Any        =			set(__snake_case				)
     return pairs







class 					_a (a__	):





     '''simple docstring'''



     lowerCAmelCase_  :     str          =					VOCAB_FILES_NAMES
     lowerCAmelCase_  :     int          =					PRETRAINED_VOCAB_FILES_MAP
     lowerCAmelCase_  :     Any          =					PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
     lowerCAmelCase_  :     Tuple          =					CONTROL_CODES







     def __init__(				self							,__a							,__a							,__a="<unk>"							,**__a							)      ->				Dict:
          super().__init__(unk_token=__a							,**__a							)

          with open(__a							,encoding="""utf-8"""							) as vocab_handle:
               snake_case			:      Union[str, Any]        =			json.load(__a							)
          snake_case			:      Union[str, Any]        =			{v: k for k, v in self.encoder.items()}
          with open(__a							,encoding="""utf-8"""							) as merges_handle:
               snake_case			:      Optional[int]        =			merges_handle.read().split("""\n"""							)[1:-1]
          snake_case			:      Optional[int]        =			[tuple(merge.split()							) for merge in merges]
          snake_case			:      int        =			dict(zip(__a							,range(len(__a							)							)							)							)
          snake_case			:      Tuple        =			{}







     @property
     def 			snake_case_      (				self							)      ->				Optional[Any]:
          return len(self.encoder							)







     def 			snake_case_      (				self							)      ->				int:
          return dict(self.encoder							,**self.added_tokens_encoder							)







     def 			snake_case_      (				self							,__a							)      ->				str:
          if token in self.cache:
               return self.cache[token]
          snake_case			:      Any        =			tuple(__a							)
          snake_case			:      Any        =			tuple(list(word[:-1]							) + [word[-1] + """</w>"""]							)
          snake_case			:      List[Any]        =			get_pairs(__a							)

          if not pairs:
               return token

          while True:
               snake_case			:      Union[str, Any]        =			min(__a							,key=lambda __a							: self.bpe_ranks.get(__a							,float("""inf"""							)							)							)
               if bigram not in self.bpe_ranks:
                    break
               snake_case ,		snake_case			:      Union[str, Any]        =			bigram
               snake_case			:      Optional[int]        =			[]
               snake_case			:      Tuple        =			0
               while i < len(__a							):
                    try:
                         snake_case			:      Optional[Any]        =			word.index(__a							,__a							)
                    except ValueError:
                         new_word.extend(word[i:]							)
                         break
                    else:
                         new_word.extend(word[i:j]							)
                         snake_case			:      Any        =			j

                    if word[i] == first and i < len(__a							) - 1 and word[i + 1] == second:
                         new_word.append(first + second							)
                         i += 2
                    else:
                         new_word.append(word[i]							)
                         i += 1
               snake_case			:      Optional[int]        =			tuple(__a							)
               snake_case			:      int        =			new_word
               if len(__a							) == 1:
                    break
               else:
                    snake_case			:      Any        =			get_pairs(__a							)
          snake_case			:      Optional[int]        =			"""@@ """.join(__a							)
          snake_case			:      Any        =			word[:-4]
          snake_case			:      int        =			word
          return word







     def 			snake_case_      (				self							,__a							)      ->				str:
          snake_case			:      Optional[Any]        =			[]

          snake_case			:      int        =			re.findall(r"""\S+\n?"""							,__a							)

          for token in words:
               split_tokens.extend(list(self.bpe(__a							).split(""" """							)							)							)
          return split_tokens







     def 			snake_case_      (				self							,__a							)      ->				List[Any]:
          return self.encoder.get(__a							,self.encoder.get(self.unk_token							)							)







     def 			snake_case_      (				self							,__a							)      ->				str:
          return self.decoder.get(__a							,self.unk_token							)







     def 			snake_case_      (				self							,__a							)      ->				List[str]:
          snake_case			:      List[str]        =			""" """.join(__a							).replace("""@@ """							,""""""							).strip()
          return out_string







     def 			snake_case_      (				self							,__a							,__a = None							)      ->				Tuple[str]:
          if not os.path.isdir(__a							):
               logger.error(F'''Vocabulary path ({save_directory}) should be a directory'''							)
               return
          snake_case			:      Optional[Any]        =			os.path.join(
              __a							,(filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""vocab_file"""]							)
          snake_case			:      int        =			os.path.join(
              __a							,(filename_prefix + """-""" if filename_prefix else """""") + VOCAB_FILES_NAMES["""merges_file"""]							)

          with open(__a							,"""w"""							,encoding="""utf-8"""							) as f:
               f.write(json.dumps(self.encoder							,indent=2							,sort_keys=__a							,ensure_ascii=__a							) + """\n"""							)

          snake_case			:      Tuple        =			0
          with open(__a							,"""w"""							,encoding="""utf-8"""							) as writer:
               writer.write("""#version: 0.2\n"""							)
               for bpe_tokens, token_index in sorted(self.bpe_ranks.items()							,key=lambda __a							: kv[1]							):
                    if index != token_index:
                         logger.warning(
                             F'''Saving vocabulary to {merge_file}: BPE merge indices are not consecutive.'''
                             """ Please check that the tokenizer is not corrupted!"""							)
                         snake_case			:      Optional[int]        =			token_index
                    writer.write(""" """.join(__a							) + """\n"""							)
                    index += 1

          return vocab_file, merge_file

     # def decode(self, token_ids, skip_special_tokens=False, clean_up_tokenization_spaces=True):
     #     filtered_tokens = ' '.join(self.convert_ids_to_tokens(token_ids, skip_special_tokens=skip_special_tokens))
     #     tokens_generated_so_far = re.sub('(@@ )', '', string=filtered_tokens)
     #     tokens_generated_so_far = re.sub('(@@ ?$)', '', string=tokens_generated_so_far)
     #     return ''.join(tokens_generated_so_far)











import unittest

from transformers import DebertaVaConfig, is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device

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 import (
      DebertaVaForMaskedLM,
      DebertaVaForMultipleChoice,
      DebertaVaForQuestionAnswering,
      DebertaVaForSequenceClassification,
      DebertaVaForTokenClassification,
      DebertaVaModel,
  )
  from transformers.models.deberta_va.modeling_deberta_va import DEBERTA_V2_PRETRAINED_MODEL_ARCHIVE_LIST
class 		SCREAMING_SNAKE_CASE__	(  UpperCAmelCase     ):

  '''simple docstring'''







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


         """simple docstring"""
         _UpperCAmelCase							=    parent
         _UpperCAmelCase							=    batch_size
         _UpperCAmelCase							=    seq_length
         _UpperCAmelCase							=    is_training
         _UpperCAmelCase							=    use_input_mask
         _UpperCAmelCase							=    use_token_type_ids
         _UpperCAmelCase							=    use_labels
         _UpperCAmelCase							=    vocab_size
         _UpperCAmelCase							=    hidden_size
         _UpperCAmelCase							=    num_hidden_layers
         _UpperCAmelCase							=    num_attention_heads
         _UpperCAmelCase							=    intermediate_size
         _UpperCAmelCase							=    hidden_act
         _UpperCAmelCase							=    hidden_dropout_prob
         _UpperCAmelCase							=    attention_probs_dropout_prob
         _UpperCAmelCase							=    max_position_embeddings
         _UpperCAmelCase							=    type_vocab_size
         _UpperCAmelCase							=    type_sequence_label_size
         _UpperCAmelCase							=    initializer_range
         _UpperCAmelCase							=    num_labels
         _UpperCAmelCase							=    num_choices
         _UpperCAmelCase							=    relative_attention
         _UpperCAmelCase							=    position_biased_input
         _UpperCAmelCase							=    pos_att_type
         _UpperCAmelCase							=    scope


  def  lowerCamelCase       (      self		:			str							)						->	Union[str, Any]:


         """simple docstring"""
         _UpperCAmelCase							=    ids_tensor([self.batch_size, self.seq_length]       ,				self.vocab_size							)

         _UpperCAmelCase							=    None
         if self.use_input_mask:
                _UpperCAmelCase							=    ids_tensor([self.batch_size, self.seq_length]       ,				vocab_size=2							)

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

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

         _UpperCAmelCase							=    self.get_config()

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


  def  lowerCamelCase       (      self		:			Dict							)						->	Dict:


         """simple docstring"""
         return 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       ,				initializer_range=self.initializer_range       ,				relative_attention=self.relative_attention       ,				position_biased_input=self.position_biased_input       ,				pos_att_type=self.pos_att_type       ,				)


  def  lowerCamelCase       (      self		:			Union[str, Any]       ,				lowerCamelCase		:			List[Any]							)						->	Union[str, Any]:


         """simple docstring"""
         self.parent.assertListEqual(list(result.loss.size()							)       ,				[]							)


  def  lowerCamelCase       (      self		:			Optional[Any]       ,				lowerCamelCase		:			int       ,				lowerCamelCase		:			List[Any]       ,				lowerCamelCase		:			int       ,				lowerCamelCase		:			Union[str, Any]       ,				lowerCamelCase		:			List[str]       ,				lowerCamelCase		:			List[str]       ,				lowerCamelCase		:			Any							)						->	List[Any]:


         """simple docstring"""
         _UpperCAmelCase							=    DebertaVaModel(config=lowerCamelCase							)
         model.to(lowerCamelCase							)
         model.eval()
         _UpperCAmelCase							=    model(lowerCamelCase       ,				attention_mask=lowerCamelCase       ,				token_type_ids=lowerCamelCase							)[0]
         _UpperCAmelCase							=    model(lowerCamelCase       ,				token_type_ids=lowerCamelCase							)[0]
         _UpperCAmelCase							=    model(lowerCamelCase							)[0]

         self.parent.assertListEqual(list(sequence_output.size()							)       ,				[self.batch_size, self.seq_length, self.hidden_size]							)


  def  lowerCamelCase       (      self		:			List[str]       ,				lowerCamelCase		:			Any       ,				lowerCamelCase		:			Optional[int]       ,				lowerCamelCase		:			int       ,				lowerCamelCase		:			Tuple       ,				lowerCamelCase		:			Optional[Any]       ,				lowerCamelCase		:			List[str]       ,				lowerCamelCase		:			List[Any]							)						->	List[str]:


         """simple docstring"""
         _UpperCAmelCase							=    DebertaVaForMaskedLM(config=lowerCamelCase							)
         model.to(lowerCamelCase							)
         model.eval()
         _UpperCAmelCase							=    model(lowerCamelCase       ,				attention_mask=lowerCamelCase       ,				token_type_ids=lowerCamelCase       ,				labels=lowerCamelCase							)

         self.parent.assertEqual(result.logits.shape       ,				(self.batch_size, self.seq_length, self.vocab_size)							)


  def  lowerCamelCase       (      self		:			str       ,				lowerCamelCase		:			Optional[Any]       ,				lowerCamelCase		:			List[str]       ,				lowerCamelCase		:			Dict       ,				lowerCamelCase		:			List[Any]       ,				lowerCamelCase		:			List[str]       ,				lowerCamelCase		:			Optional[Any]       ,				lowerCamelCase		:			Any							)						->	Union[str, Any]:


         """simple docstring"""
         _UpperCAmelCase							=    self.num_labels
         _UpperCAmelCase							=    DebertaVaForSequenceClassification(lowerCamelCase							)
         model.to(lowerCamelCase							)
         model.eval()
         _UpperCAmelCase							=    model(lowerCamelCase       ,				attention_mask=lowerCamelCase       ,				token_type_ids=lowerCamelCase       ,				labels=lowerCamelCase							)
         self.parent.assertListEqual(list(result.logits.size()							)       ,				[self.batch_size, self.num_labels]							)
         self.check_loss_output(lowerCamelCase							)


  def  lowerCamelCase       (      self		:			Dict       ,				lowerCamelCase		:			List[str]       ,				lowerCamelCase		:			int       ,				lowerCamelCase		:			Optional[Any]       ,				lowerCamelCase		:			Dict       ,				lowerCamelCase		:			Union[str, Any]       ,				lowerCamelCase		:			Optional[int]       ,				lowerCamelCase		:			Union[str, Any]							)						->	Tuple:


         """simple docstring"""
         _UpperCAmelCase							=    self.num_labels
         _UpperCAmelCase							=    DebertaVaForTokenClassification(config=lowerCamelCase							)
         model.to(lowerCamelCase							)
         model.eval()
         _UpperCAmelCase							=    model(lowerCamelCase       ,				attention_mask=lowerCamelCase       ,				token_type_ids=lowerCamelCase       ,				labels=lowerCamelCase							)
         self.parent.assertEqual(result.logits.shape       ,				(self.batch_size, self.seq_length, self.num_labels)							)


  def  lowerCamelCase       (      self		:			Any       ,				lowerCamelCase		:			Tuple       ,				lowerCamelCase		:			Any       ,				lowerCamelCase		:			str       ,				lowerCamelCase		:			Tuple       ,				lowerCamelCase		:			Optional[int]       ,				lowerCamelCase		:			Optional[Any]       ,				lowerCamelCase		:			str							)						->	Tuple:


         """simple docstring"""
         _UpperCAmelCase							=    DebertaVaForQuestionAnswering(config=lowerCamelCase							)
         model.to(lowerCamelCase							)
         model.eval()
         _UpperCAmelCase							=    model(
             lowerCamelCase       ,				attention_mask=lowerCamelCase       ,				token_type_ids=lowerCamelCase       ,				start_positions=lowerCamelCase       ,				end_positions=lowerCamelCase       ,				)
         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		:			Dict       ,				lowerCamelCase		:			List[str]       ,				lowerCamelCase		:			str       ,				lowerCamelCase		:			Any       ,				lowerCamelCase		:			Tuple       ,				lowerCamelCase		:			Optional[Any]       ,				lowerCamelCase		:			Any       ,				lowerCamelCase		:			str							)						->	str:


         """simple docstring"""
         _UpperCAmelCase							=    DebertaVaForMultipleChoice(config=lowerCamelCase							)
         model.to(lowerCamelCase							)
         model.eval()
         _UpperCAmelCase							=    input_ids.unsqueeze(1							).expand(-1       ,				self.num_choices       ,				-1							).contiguous()
         _UpperCAmelCase							=    token_type_ids.unsqueeze(1							).expand(-1       ,				self.num_choices       ,				-1							).contiguous()
         _UpperCAmelCase							=    input_mask.unsqueeze(1							).expand(-1       ,				self.num_choices       ,				-1							).contiguous()
         _UpperCAmelCase							=    model(
             lowerCamelCase       ,				attention_mask=lowerCamelCase       ,				token_type_ids=lowerCamelCase       ,				labels=lowerCamelCase       ,				)
         self.parent.assertEqual(result.logits.shape       ,				(self.batch_size, self.num_choices)							)





  def  lowerCamelCase       (      self		:			List[str]							)						->	Optional[int]:


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



@require_torch
class 		SCREAMING_SNAKE_CASE__	(  UpperCAmelCase					,      UpperCAmelCase					,      unittest.TestCase     ):

  '''simple docstring'''







  _lowerCamelCase    =  (
      (
          DebertaVaModel,
          DebertaVaForMaskedLM,
          DebertaVaForSequenceClassification,
          DebertaVaForTokenClassification,
          DebertaVaForQuestionAnswering,
          DebertaVaForMultipleChoice,
      )
      if is_torch_available()
      else ()
  )
  _lowerCamelCase    =  (
      {
          '''feature-extraction''': DebertaVaModel,
          '''fill-mask''': DebertaVaForMaskedLM,
          '''question-answering''': DebertaVaForQuestionAnswering,
          '''text-classification''': DebertaVaForSequenceClassification,
          '''token-classification''': DebertaVaForTokenClassification,
          '''zero-shot''': DebertaVaForSequenceClassification,
      }
      if is_torch_available()
      else {}
  )

  _lowerCamelCase    =  True
  _lowerCamelCase    =  False
  _lowerCamelCase    =  False
  _lowerCamelCase    =  False
  _lowerCamelCase    =  False


  def  lowerCamelCase       (      self		:			int							)						->	List[str]:


         """simple docstring"""
         _UpperCAmelCase							=    DebertaVaModelTester(self							)
         _UpperCAmelCase							=    ConfigTester(self       ,				config_class=lowerCamelCase       ,				hidden_size=37							)


  def  lowerCamelCase       (      self		:			Optional[int]							)						->	Tuple:


         """simple docstring"""
         self.config_tester.run_common_tests()


  def  lowerCamelCase       (      self		:			Tuple							)						->	Tuple:


         """simple docstring"""
         _UpperCAmelCase							=    self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_deberta_model(*lowerCamelCase							)


  def  lowerCamelCase       (      self		:			List[Any]							)						->	Any:


         """simple docstring"""
         _UpperCAmelCase							=    self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_deberta_for_sequence_classification(*lowerCamelCase							)


  def  lowerCamelCase       (      self		:			Union[str, Any]							)						->	List[str]:


         """simple docstring"""
         _UpperCAmelCase							=    self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_deberta_for_masked_lm(*lowerCamelCase							)


  def  lowerCamelCase       (      self		:			Tuple							)						->	Tuple:


         """simple docstring"""
         _UpperCAmelCase							=    self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_deberta_for_question_answering(*lowerCamelCase							)


  def  lowerCamelCase       (      self		:			Dict							)						->	List[str]:


         """simple docstring"""
         _UpperCAmelCase							=    self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_deberta_for_token_classification(*lowerCamelCase							)


  def  lowerCamelCase       (      self		:			int							)						->	List[Any]:


         """simple docstring"""
         _UpperCAmelCase							=    self.model_tester.prepare_config_and_inputs()
         self.model_tester.create_and_check_deberta_for_multiple_choice(*lowerCamelCase							)





  @slow
  def  lowerCamelCase       (      self		:			Dict							)						->	Optional[int]:


         """simple docstring"""
         for model_name in DEBERTA_V2_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
                _UpperCAmelCase							=    DebertaVaModel.from_pretrained(lowerCamelCase							)
                self.assertIsNotNone(lowerCamelCase							)



@require_torch
@require_sentencepiece
@require_tokenizers
class 		SCREAMING_SNAKE_CASE__	(  unittest.TestCase     ):

  '''simple docstring'''







  @unittest.skip(reason="""Model not available yet"""							)
  def  lowerCamelCase       (      self		:			Any							)						->	Tuple:


         """simple docstring"""
         pass





  @slow
  def  lowerCamelCase       (      self		:			Union[str, Any]							)						->	int:


         """simple docstring"""
         _UpperCAmelCase							=    DebertaVaModel.from_pretrained("""microsoft/deberta-v2-xlarge"""							)

         _UpperCAmelCase							=    torch.tensor([[0, 3_1414, 232, 328, 740, 1140, 1_2695, 69, 4_6078, 1588, 2]]							)
         _UpperCAmelCase							=    torch.tensor([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]							)
         with torch.no_grad():
                _UpperCAmelCase							=    model(lowerCamelCase       ,				attention_mask=lowerCamelCase							)[0]
         # compare the actual values for a slice.
         _UpperCAmelCase							=    torch.tensor(
             [[[0.2356, 0.1948, 0.0369], [-0.1063, 0.3586, -0.5152], [-0.6399, -0.0259, -0.2525]]]							)
         self.assertTrue(torch.allclose(output[:, 1:4, 1:4]       ,				lowerCamelCase       ,				atol=1E-4							)       ,				f"""{output[:, 1:4, 1:4]}"""							)