
from __future__ import annotations

import unittest

from transformers import MobileBertConfig, is_tf_available
from transformers.models.auto import get_values
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 (
        TF_MODEL_FOR_PRETRAINING_MAPPING,
        TFMobileBertForMaskedLM,
        TFMobileBertForMultipleChoice,
        TFMobileBertForNextSentencePrediction,
        TFMobileBertForPreTraining,
        TFMobileBertForQuestionAnswering,
        TFMobileBertForSequenceClassification,
        TFMobileBertForTokenClassification,
        TFMobileBertModel,
    )




@require_tf
class 					_lowerCamelCase			(   UpperCamelCase_						,				UpperCamelCase_						,				unittest.TestCase			):





     """simple docstring"""







     SCREAMING_SNAKE_CASE_		 =	(
         (
             TFMobileBertModel,
             TFMobileBertForMaskedLM,
             TFMobileBertForNextSentencePrediction,
             TFMobileBertForPreTraining,
             TFMobileBertForQuestionAnswering,
             TFMobileBertForSequenceClassification,
             TFMobileBertForTokenClassification,
             TFMobileBertForMultipleChoice,
         )
         if is_tf_available()
         else ()
     )
     SCREAMING_SNAKE_CASE_		 =	(
         {
             '''feature-extraction''': TFMobileBertModel,
             '''fill-mask''': TFMobileBertForMaskedLM,
             '''question-answering''': TFMobileBertForQuestionAnswering,
             '''text-classification''': TFMobileBertForSequenceClassification,
             '''token-classification''': TFMobileBertForTokenClassification,
             '''zero-shot''': TFMobileBertForSequenceClassification,
         }
         if is_tf_available()
         else {}
     )
     SCREAMING_SNAKE_CASE_		 =	False
     SCREAMING_SNAKE_CASE_		 =	False






     def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE=False	)	-> int:




           """simple docstring"""







           UpperCamelCase__     : Union[str, Any]											=					super()._prepare_for_class(__SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    return_labels=__SCREAMING_SNAKE_CASE	)

           if return_labels:
                 if model_class in get_values(__SCREAMING_SNAKE_CASE	):
                       UpperCamelCase__     : Optional[int]											=					tf.zeros(self.model_tester.batch_size    ,    dtype=tf.intaa	)

           return inputs_dict




     class 					_lowerCamelCase			(   UpperCamelCase_			):





          """simple docstring"""







          def __init__(				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE=1_3    ,    __SCREAMING_SNAKE_CASE=7    ,    __SCREAMING_SNAKE_CASE=True    ,    __SCREAMING_SNAKE_CASE=True    ,    __SCREAMING_SNAKE_CASE=True    ,    __SCREAMING_SNAKE_CASE=True    ,    __SCREAMING_SNAKE_CASE=9_9    ,    __SCREAMING_SNAKE_CASE=3_2    ,    __SCREAMING_SNAKE_CASE=3_2    ,    __SCREAMING_SNAKE_CASE=2    ,    __SCREAMING_SNAKE_CASE=4    ,    __SCREAMING_SNAKE_CASE=3_7    ,    __SCREAMING_SNAKE_CASE="gelu"    ,    __SCREAMING_SNAKE_CASE=0.1    ,    __SCREAMING_SNAKE_CASE=0.1    ,    __SCREAMING_SNAKE_CASE=5_1_2    ,    __SCREAMING_SNAKE_CASE=1_6    ,    __SCREAMING_SNAKE_CASE=2    ,    __SCREAMING_SNAKE_CASE=0.02    ,    __SCREAMING_SNAKE_CASE=3    ,    __SCREAMING_SNAKE_CASE=4    ,    __SCREAMING_SNAKE_CASE=None    ,    )	-> List[Any]:




                """simple docstring"""







                UpperCamelCase__     : List[Any]											=					parent
                UpperCamelCase__     : List[str]											=					batch_size
                UpperCamelCase__     : List[str]											=					seq_length
                UpperCamelCase__     : List[str]											=					is_training
                UpperCamelCase__     : str											=					use_input_mask
                UpperCamelCase__     : Union[str, Any]											=					use_token_type_ids
                UpperCamelCase__     : Optional[Any]											=					use_labels
                UpperCamelCase__     : int											=					vocab_size
                UpperCamelCase__     : Any											=					hidden_size
                UpperCamelCase__     : Tuple											=					num_hidden_layers
                UpperCamelCase__     : Any											=					num_attention_heads
                UpperCamelCase__     : str											=					intermediate_size
                UpperCamelCase__     : Dict											=					hidden_act
                UpperCamelCase__     : Optional[Any]											=					hidden_dropout_prob
                UpperCamelCase__     : Tuple											=					attention_probs_dropout_prob
                UpperCamelCase__     : Any											=					max_position_embeddings
                UpperCamelCase__     : List[str]											=					type_vocab_size
                UpperCamelCase__     : Dict											=					type_sequence_label_size
                UpperCamelCase__     : Dict											=					initializer_range
                UpperCamelCase__     : int											=					num_labels
                UpperCamelCase__     : Optional[Any]											=					num_choices
                UpperCamelCase__     : Union[str, Any]											=					scope
                UpperCamelCase__     : List[Any]											=					embedding_size






          def  __SCREAMING_SNAKE_CASE      (				self	)	-> str:




                """simple docstring"""







                UpperCamelCase__     : int											=					ids_tensor([self.batch_size, self.seq_length]    ,    self.vocab_size	)

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

                UpperCamelCase__     : Dict											=					None
                if self.use_token_type_ids:
                      UpperCamelCase__     : List[str]											=					ids_tensor([self.batch_size, self.seq_length]    ,    self.type_vocab_size	)

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

                UpperCamelCase__     : Optional[int]											=					MobileBertConfig(
                    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    ,    embedding_size=self.embedding_size    ,    )

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






          def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)	-> Any:




                """simple docstring"""







                UpperCamelCase__     : List[Any]											=					TFMobileBertModel(config=__SCREAMING_SNAKE_CASE	)
                UpperCamelCase__     : Any											=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
                UpperCamelCase__     : Dict											=					model(__SCREAMING_SNAKE_CASE	)

                UpperCamelCase__     : Dict											=					[input_ids, input_mask]
                UpperCamelCase__     : Tuple											=					model(__SCREAMING_SNAKE_CASE	)

                UpperCamelCase__     : Any											=					model(__SCREAMING_SNAKE_CASE	)

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






          def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)	-> Dict:




                """simple docstring"""







                UpperCamelCase__     : Union[str, Any]											=					TFMobileBertForMaskedLM(config=__SCREAMING_SNAKE_CASE	)
                UpperCamelCase__     : Tuple											=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
                UpperCamelCase__     : str											=					model(__SCREAMING_SNAKE_CASE	)
                self.parent.assertEqual(result.logits.shape    ,    (self.batch_size, self.seq_length, self.vocab_size)	)






          def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)	-> List[Any]:




                """simple docstring"""







                UpperCamelCase__     : Union[str, Any]											=					TFMobileBertForNextSentencePrediction(config=__SCREAMING_SNAKE_CASE	)
                UpperCamelCase__     : Any											=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
                UpperCamelCase__     : List[str]											=					model(__SCREAMING_SNAKE_CASE	)
                self.parent.assertEqual(result.logits.shape    ,    (self.batch_size, 2)	)






          def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)	-> Optional[Any]:




                """simple docstring"""







                UpperCamelCase__     : List[str]											=					TFMobileBertForPreTraining(config=__SCREAMING_SNAKE_CASE	)
                UpperCamelCase__     : List[Any]											=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
                UpperCamelCase__     : str											=					model(__SCREAMING_SNAKE_CASE	)
                self.parent.assertEqual(
                    result.prediction_logits.shape    ,    (self.batch_size, self.seq_length, self.vocab_size)	)
                self.parent.assertEqual(result.seq_relationship_logits.shape    ,    (self.batch_size, 2)	)






          def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)	-> Any:




                """simple docstring"""







                UpperCamelCase__     : Any											=					self.num_labels
                UpperCamelCase__     : Any											=					TFMobileBertForSequenceClassification(config=__SCREAMING_SNAKE_CASE	)
                UpperCamelCase__     : int											=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
                UpperCamelCase__     : Tuple											=					model(__SCREAMING_SNAKE_CASE	)
                self.parent.assertEqual(result.logits.shape    ,    (self.batch_size, self.num_labels)	)






          def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)	-> List[str]:




                """simple docstring"""







                UpperCamelCase__     : Union[str, Any]											=					self.num_choices
                UpperCamelCase__     : Tuple											=					TFMobileBertForMultipleChoice(config=__SCREAMING_SNAKE_CASE	)
                UpperCamelCase__     : List[Any]											=					tf.tile(tf.expand_dims(__SCREAMING_SNAKE_CASE    ,    1	)    ,    (1, self.num_choices, 1)	)
                UpperCamelCase__     : List[str]											=					tf.tile(tf.expand_dims(__SCREAMING_SNAKE_CASE    ,    1	)    ,    (1, self.num_choices, 1)	)
                UpperCamelCase__     : Optional[Any]											=					tf.tile(tf.expand_dims(__SCREAMING_SNAKE_CASE    ,    1	)    ,    (1, self.num_choices, 1)	)
                UpperCamelCase__     : Tuple											=					{
                    '''input_ids''': multiple_choice_inputs_ids,
                    '''attention_mask''': multiple_choice_input_mask,
                    '''token_type_ids''': multiple_choice_token_type_ids,
                }
                UpperCamelCase__     : List[Any]											=					model(__SCREAMING_SNAKE_CASE	)
                self.parent.assertEqual(result.logits.shape    ,    (self.batch_size, self.num_choices)	)






          def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)	-> Optional[Any]:




                """simple docstring"""







                UpperCamelCase__     : str											=					self.num_labels
                UpperCamelCase__     : str											=					TFMobileBertForTokenClassification(config=__SCREAMING_SNAKE_CASE	)
                UpperCamelCase__     : Optional[Any]											=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
                UpperCamelCase__     : Union[str, Any]											=					model(__SCREAMING_SNAKE_CASE	)
                self.parent.assertEqual(result.logits.shape    ,    (self.batch_size, self.seq_length, self.num_labels)	)






          def  __SCREAMING_SNAKE_CASE      (				self    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE    ,    __SCREAMING_SNAKE_CASE	)	-> List[str]:




                """simple docstring"""







                UpperCamelCase__     : Union[str, Any]											=					TFMobileBertForQuestionAnswering(config=__SCREAMING_SNAKE_CASE	)
                UpperCamelCase__     : str											=					{'''input_ids''': input_ids, '''attention_mask''': input_mask, '''token_type_ids''': token_type_ids}
                UpperCamelCase__     : Dict											=					model(__SCREAMING_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  __SCREAMING_SNAKE_CASE      (				self	)	-> Any:




                """simple docstring"""







                UpperCamelCase__     : Any											=					self.prepare_config_and_inputs()
                (
                    (
                    UpperCamelCase__
                )					,(
                    UpperCamelCase__
                )					,(
                    UpperCamelCase__
                )					,(
                    UpperCamelCase__
                )					,(
                    UpperCamelCase__
                )					,(
                    UpperCamelCase__
                )					,(
                    UpperCamelCase__
                )					,
                )     : Tuple											=					config_and_inputs
                UpperCamelCase__     : Dict											=					{'''input_ids''': input_ids, '''token_type_ids''': token_type_ids, '''attention_mask''': input_mask}
                return config, inputs_dict






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Any:




           """simple docstring"""







           UpperCamelCase__     : Optional[int]											=					TFMobileBertModelTest.TFMobileBertModelTester(self	)
           UpperCamelCase__     : Optional[Any]											=					ConfigTester(self    ,    config_class=__SCREAMING_SNAKE_CASE    ,    hidden_size=3_7	)






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




           """simple docstring"""







           self.config_tester.run_common_tests()






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Optional[int]:




           """simple docstring"""







           UpperCamelCase__     : int											=					self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_mobilebert_model(*__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> List[str]:




           """simple docstring"""







           UpperCamelCase__     : Tuple											=					self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_mobilebert_for_masked_lm(*__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Optional[Any]:




           """simple docstring"""







           UpperCamelCase__     : Any											=					self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_mobilebert_for_multiple_choice(*__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Dict:




           """simple docstring"""







           UpperCamelCase__     : int											=					self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_mobilebert_for_next_sequence_prediction(*__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Optional[Any]:




           """simple docstring"""







           UpperCamelCase__     : Optional[int]											=					self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_mobilebert_for_pretraining(*__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Tuple:




           """simple docstring"""







           UpperCamelCase__     : Dict											=					self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_mobilebert_for_question_answering(*__SCREAMING_SNAKE_CASE	)






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




           """simple docstring"""







           UpperCamelCase__     : Optional[Any]											=					self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_mobilebert_for_sequence_classification(*__SCREAMING_SNAKE_CASE	)






     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Any:




           """simple docstring"""







           UpperCamelCase__     : Any											=					self.model_tester.prepare_config_and_inputs()
           self.model_tester.create_and_check_mobilebert_for_token_classification(*__SCREAMING_SNAKE_CASE	)






     @slow
     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Any:




           """simple docstring"""







           for model_name in ["google/mobilebert-uncased"]:
                 UpperCamelCase__     : Dict											=					TFMobileBertModel.from_pretrained(__SCREAMING_SNAKE_CASE	)
                 self.assertIsNotNone(__SCREAMING_SNAKE_CASE	)




@require_tf
class 					_lowerCamelCase			(   unittest.TestCase			):





     """simple docstring"""







     @slow
     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Dict:




           """simple docstring"""







           UpperCamelCase__     : str											=					TFMobileBertForPreTraining.from_pretrained('''google/mobilebert-uncased'''	)
           UpperCamelCase__     : Union[str, Any]											=					tf.constant([[0, 1, 2, 3, 4, 5]]	)
           UpperCamelCase__     : Dict											=					model(__SCREAMING_SNAKE_CASE	)[0]

           UpperCamelCase__     : Any											=					[1, 6, 3_0_5_2_2]
           self.assertEqual(output.shape    ,    __SCREAMING_SNAKE_CASE	)

           UpperCamelCase__     : str											=					tf.constant(
               [
                   [
                       [-4.5919547, -9.248295, -9.645256],
                       [-6.7306175, -6.440284, -6.6052837],
                       [-7.2743506, -6.7847915, -6.024673],
                   ]
               ]	)
           tf.debugging.assert_near(output[:, :3, :3]    ,    __SCREAMING_SNAKE_CASE    ,    atol=1e-4	)




from collections import OrderedDict
from typing import Mapping

from ...configuration_utils import PretrainedConfig
from ...onnx import OnnxConfig
from ...utils import logging


lowerCamelCase  =logging.get_logger(__name__)

lowerCamelCase  ={
    "distilbert-base-uncased": "https://huggingface.co/distilbert-base-uncased/resolve/main/config.json",
    "distilbert-base-uncased-distilled-squad": (
        "https://huggingface.co/distilbert-base-uncased-distilled-squad/resolve/main/config.json"
    ),
    "distilbert-base-cased": "https://huggingface.co/distilbert-base-cased/resolve/main/config.json",
    "distilbert-base-cased-distilled-squad": (
        "https://huggingface.co/distilbert-base-cased-distilled-squad/resolve/main/config.json"
    ),
    "distilbert-base-german-cased": "https://huggingface.co/distilbert-base-german-cased/resolve/main/config.json",
    "distilbert-base-multilingual-cased": (
        "https://huggingface.co/distilbert-base-multilingual-cased/resolve/main/config.json"
    ),
    "distilbert-base-uncased-finetuned-sst-2-english": (
        "https://huggingface.co/distilbert-base-uncased-finetuned-sst-2-english/resolve/main/config.json"
    ),
}




class 					_lowerCamelCase			(   UpperCamelCase_			):





     """simple docstring"""







     SCREAMING_SNAKE_CASE_		 =	'''distilbert'''
     SCREAMING_SNAKE_CASE_		 =	{
         '''hidden_size''': '''dim''',
         '''num_attention_heads''': '''n_heads''',
         '''num_hidden_layers''': '''n_layers''',
     }






     def __init__(				self    ,    __SCREAMING_SNAKE_CASE=3_0_5_2_2    ,    __SCREAMING_SNAKE_CASE=5_1_2    ,    __SCREAMING_SNAKE_CASE=False    ,    __SCREAMING_SNAKE_CASE=6    ,    __SCREAMING_SNAKE_CASE=1_2    ,    __SCREAMING_SNAKE_CASE=7_6_8    ,    __SCREAMING_SNAKE_CASE=4 * 7_6_8    ,    __SCREAMING_SNAKE_CASE=0.1    ,    __SCREAMING_SNAKE_CASE=0.1    ,    __SCREAMING_SNAKE_CASE="gelu"    ,    __SCREAMING_SNAKE_CASE=0.02    ,    __SCREAMING_SNAKE_CASE=0.1    ,    __SCREAMING_SNAKE_CASE=0.2    ,    __SCREAMING_SNAKE_CASE=0    ,    **__SCREAMING_SNAKE_CASE    ,    )	-> Optional[Any]:




           """simple docstring"""







           UpperCamelCase__     : List[Any]											=					vocab_size
           UpperCamelCase__     : Dict											=					max_position_embeddings
           UpperCamelCase__     : Any											=					sinusoidal_pos_embds
           UpperCamelCase__     : Dict											=					n_layers
           UpperCamelCase__     : List[Any]											=					n_heads
           UpperCamelCase__     : Dict											=					dim
           UpperCamelCase__     : Dict											=					hidden_dim
           UpperCamelCase__     : Optional[int]											=					dropout
           UpperCamelCase__     : Optional[Any]											=					attention_dropout
           UpperCamelCase__     : Tuple											=					activation
           UpperCamelCase__     : Optional[int]											=					initializer_range
           UpperCamelCase__     : Optional[int]											=					qa_dropout
           UpperCamelCase__     : str											=					seq_classif_dropout
           super().__init__(**__SCREAMING_SNAKE_CASE    ,    pad_token_id=__SCREAMING_SNAKE_CASE	)




class 					_lowerCamelCase			(   UpperCamelCase_			):





     """simple docstring"""







     @property
     def  __SCREAMING_SNAKE_CASE      (				self	)	-> Mapping[str, Mapping[int, str]]:




           """simple docstring"""







           if self.task == "multiple-choice":
                 UpperCamelCase__     : Union[str, Any]											=					{0: '''batch''', 1: '''choice''', 2: '''sequence'''}
           else:
                 UpperCamelCase__     : int											=					{0: '''batch''', 1: '''sequence'''}
           return OrderedDict(
               [
                   ('''input_ids''', dynamic_axis),
                   ('''attention_mask''', dynamic_axis),
               ]	)


