"""simple docstring"""



import unittest

from transformers import DebertaConfig, 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 (
       DebertaForMaskedLM,
       DebertaForQuestionAnswering,
       DebertaForSequenceClassification,
       DebertaForTokenClassification,
       DebertaModel,
   )
   from transformers.models.deberta.modeling_deberta import DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST






class 				snake_case__     (   snake_case_   ):


 def __init__(				self  ,						lowerCamelCase  ,						lowerCamelCase=13  ,						lowerCamelCase=7  ,						lowerCamelCase=True  ,						lowerCamelCase=True  ,						lowerCamelCase=True  ,						lowerCamelCase=True  ,						lowerCamelCase=99  ,						lowerCamelCase=32  ,						lowerCamelCase=5  ,						lowerCamelCase=4  ,						lowerCamelCase=37  ,						lowerCamelCase="gelu"  ,						lowerCamelCase=0.1  ,						lowerCamelCase=0.1  ,						lowerCamelCase=512  ,						lowerCamelCase=16  ,						lowerCamelCase=2  ,						lowerCamelCase=0.02  ,						lowerCamelCase=False  ,						lowerCamelCase=True  ,						lowerCamelCase="None"  ,						lowerCamelCase=3  ,						lowerCamelCase=4  ,						lowerCamelCase=None  ,						):
        __a     				=  parent
        __a     				=  batch_size
        __a     				=  seq_length
        __a     				=  is_training
        __a     				=  use_input_mask
        __a     				=  use_token_type_ids
        __a     				=  use_labels
        __a     				=  vocab_size
        __a     				=  hidden_size
        __a     				=  num_hidden_layers
        __a     				=  num_attention_heads
        __a     				=  intermediate_size
        __a     				=  hidden_act
        __a     				=  hidden_dropout_prob
        __a     				=  attention_probs_dropout_prob
        __a     				=  max_position_embeddings
        __a     				=  type_vocab_size
        __a     				=  type_sequence_label_size
        __a     				=  initializer_range
        __a     				=  num_labels
        __a     				=  num_choices
        __a     				=  relative_attention
        __a     				=  position_biased_input
        __a     				=  pos_att_type
        __a     				=  scope


 def 		a__ (				self		):
        __a     				=  ids_tensor([self.batch_size, self.seq_length]  ,						self.vocab_size		)

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

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

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

        __a     				=  self.get_config()

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


 def 		a__ (				self		):
        return 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  ,						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 		a__ (				self		):
        __a     				=  self.get_config()
        __a     				=  300
        return config


 def 		a__ (				self  ,						lowerCamelCase		):
        self.parent.assertListEqual(list(result.loss.size()		)  ,						[]		)


 def 		a__ (				self  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase		):
        __a     				=  DebertaModel(config=lowerCamelCase		)
        model.to(lowerCamelCase		)
        model.eval()
        __a     				=  model(lowerCamelCase  ,						attention_mask=lowerCamelCase  ,						token_type_ids=lowerCamelCase		)[0]
        __a     				=  model(lowerCamelCase  ,						token_type_ids=lowerCamelCase		)[0]
        __a     				=  model(lowerCamelCase		)[0]

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


 def 		a__ (				self  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase		):
        __a     				=  DebertaForMaskedLM(config=lowerCamelCase		)
        model.to(lowerCamelCase		)
        model.eval()
        __a     				=  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 		a__ (				self  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase		):
        __a     				=  self.num_labels
        __a     				=  DebertaForSequenceClassification(lowerCamelCase		)
        model.to(lowerCamelCase		)
        model.eval()
        __a     				=  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 		a__ (				self  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase		):
        __a     				=  self.num_labels
        __a     				=  DebertaForTokenClassification(config=lowerCamelCase		)
        model.to(lowerCamelCase		)
        model.eval()
        __a     				=  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 		a__ (				self  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase  ,						lowerCamelCase		):
        __a     				=  DebertaForQuestionAnswering(config=lowerCamelCase		)
        model.to(lowerCamelCase		)
        model.eval()
        __a     				=  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 		a__ (				self		):
        __a     				=  self.prepare_config_and_inputs()
        (
            (
            __a
        )				, (
            __a
        )				, (
            __a
        )				, (
            __a
        )				, (
            __a
        )				, (
            __a
        )				, (
            __a
        )				, 
        )     				=  config_and_inputs
        __a     				=  {"input_ids": input_ids, "token_type_ids": token_type_ids, "attention_mask": input_mask}
        return config, inputs_dict






@require_torch
class 				snake_case__     (   snake_case_,		snake_case_,		unittest.TestCase   ):
 _snake_case   :			List[str]           =		(
     (
         DebertaModel,
         DebertaForMaskedLM,
         DebertaForSequenceClassification,
         DebertaForTokenClassification,
         DebertaForQuestionAnswering,
     )
     if is_torch_available()
     else ()
 )
 _snake_case   :			Optional[int]           =		(
     {
         """feature-extraction""": DebertaModel,
         """fill-mask""": DebertaForMaskedLM,
         """question-answering""": DebertaForQuestionAnswering,
         """text-classification""": DebertaForSequenceClassification,
         """token-classification""": DebertaForTokenClassification,
         """zero-shot""": DebertaForSequenceClassification,
     }
     if is_torch_available()
     else {}
 )

 _snake_case   :			Optional[Any]           =		True
 _snake_case   :			Any           =		False
 _snake_case   :			Optional[Any]           =		False
 _snake_case   :			str           =		False
 _snake_case   :			Union[str, Any]           =		False


 def 		a__ (				self		):
        __a     				=  DebertaModelTester(self		)
        __a     				=  ConfigTester(self  ,						config_class=lowerCamelCase  ,						hidden_size=37		)


 def 		a__ (				self		):
        self.config_tester.run_common_tests()


 def 		a__ (				self		):
        __a     				=  self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_deberta_model(*lowerCamelCase		)


 def 		a__ (				self		):
        __a     				=  self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_deberta_for_sequence_classification(*lowerCamelCase		)


 def 		a__ (				self		):
        __a     				=  self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_deberta_for_masked_lm(*lowerCamelCase		)


 def 		a__ (				self		):
        __a     				=  self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_deberta_for_question_answering(*lowerCamelCase		)


 def 		a__ (				self		):
        __a     				=  self.model_tester.prepare_config_and_inputs()
        self.model_tester.create_and_check_deberta_for_token_classification(*lowerCamelCase		)






 @slow
 def 		a__ (				self		):
        for model_name in DEBERTA_PRETRAINED_MODEL_ARCHIVE_LIST[:1]:
               __a     				=  DebertaModel.from_pretrained(lowerCamelCase		)
               self.assertIsNotNone(lowerCamelCase		)






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


 @unittest.skip(reason="Model not available yet"		)
 def 		a__ (				self		):
        pass






 @slow
 def 		a__ (				self		):
        __a     				=  DebertaModel.from_pretrained("microsoft/deberta-base"		)

        __a     				=  torch.tensor([[0, 31414, 232, 328, 740, 1140, 12695, 69, 46078, 1588, 2]]		)
        __a     				=  torch.tensor([[0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]]		)
        with torch.no_grad():
               __a     				=  model(lowerCamelCase  ,						attention_mask=lowerCamelCase		)[0]
        # compare the actual values for a slice.
        __a     				=  torch.tensor(
            [[[-0.5986, -0.8055, -0.8462], [1.4484, -0.9348, -0.8059], [0.3123, 0.0032, -1.4131]]]		)
        self.assertTrue(torch.allclose(output[:, 1:4, 1:4]  ,						lowerCamelCase  ,						atol=1E-4		)  ,						F"{output[:, 1:4, 1:4]}"		)

"""simple docstring"""



def 					_lowerCamelCase(					a							):
       __a     				=  len(a							)
       for i in range(1 ,  a							):
              __a     				=  collection[i]
              __a     				=  0
              __a     				=  i - 1

              while low <= high:
                     __a     				=  (low + high) // 2
                     if val < collection[mid]:
                            __a     				=  mid - 1
                     else:
                            __a     				=  mid + 1
              for j in range(a ,  a ,  -1							):
                     __a     				=  collection[j - 1]
              __a     				=  val
       return collection


if __name__ == "__main__":
   SCREAMING_SNAKE_CASE__:str			=	input("""Enter numbers separated by a comma:\n""").strip()
   SCREAMING_SNAKE_CASE__:Any			=	[int(item) for item in user_input.split(""",""")]
   print(binary_insertion_sort(unsorted))
