



'''simple docstring'''





import json
from typing import List, Optional, Tuple

from tokenizers import normalizers

from ...tokenization_utils_fast import PreTrainedTokenizerFast
from .tokenization_electra import ElectraTokenizer


A__    :   str           =					{"""vocab_file""": """vocab.txt""", """tokenizer_file""": """tokenizer.json"""}

A__    :   Dict           =					{
    """vocab_file""": {
        """google/electra-small-generator""": (
            """https://huggingface.co/google/electra-small-generator/resolve/main/vocab.txt"""
        ),
        """google/electra-base-generator""": """https://huggingface.co/google/electra-base-generator/resolve/main/vocab.txt""",
        """google/electra-large-generator""": (
            """https://huggingface.co/google/electra-large-generator/resolve/main/vocab.txt"""
        ),
        """google/electra-small-discriminator""": (
            """https://huggingface.co/google/electra-small-discriminator/resolve/main/vocab.txt"""
        ),
        """google/electra-base-discriminator""": (
            """https://huggingface.co/google/electra-base-discriminator/resolve/main/vocab.txt"""
        ),
        """google/electra-large-discriminator""": (
            """https://huggingface.co/google/electra-large-discriminator/resolve/main/vocab.txt"""
        ),
    },
    """tokenizer_file""": {
        """google/electra-small-generator""": (
            """https://huggingface.co/google/electra-small-generator/resolve/main/tokenizer.json"""
        ),
        """google/electra-base-generator""": (
            """https://huggingface.co/google/electra-base-generator/resolve/main/tokenizer.json"""
        ),
        """google/electra-large-generator""": (
            """https://huggingface.co/google/electra-large-generator/resolve/main/tokenizer.json"""
        ),
        """google/electra-small-discriminator""": (
            """https://huggingface.co/google/electra-small-discriminator/resolve/main/tokenizer.json"""
        ),
        """google/electra-base-discriminator""": (
            """https://huggingface.co/google/electra-base-discriminator/resolve/main/tokenizer.json"""
        ),
        """google/electra-large-discriminator""": (
            """https://huggingface.co/google/electra-large-discriminator/resolve/main/tokenizer.json"""
        ),
    },
}

A__    :   Optional[Any]           =					{
    """google/electra-small-generator""": 5_1_2,
    """google/electra-base-generator""": 5_1_2,
    """google/electra-large-generator""": 5_1_2,
    """google/electra-small-discriminator""": 5_1_2,
    """google/electra-base-discriminator""": 5_1_2,
    """google/electra-large-discriminator""": 5_1_2,
}

A__    :   Any           =					{
    """google/electra-small-generator""": {"""do_lower_case""": True},
    """google/electra-base-generator""": {"""do_lower_case""": True},
    """google/electra-large-generator""": {"""do_lower_case""": True},
    """google/electra-small-discriminator""": {"""do_lower_case""": True},
    """google/electra-base-discriminator""": {"""do_lower_case""": True},
    """google/electra-large-discriminator""": {"""do_lower_case""": True},
}



class  snake_case__						(    __lowercase				):
 A__				= VOCAB_FILES_NAMES
 A__				= PRETRAINED_VOCAB_FILES_MAP
 A__				= PRETRAINED_INIT_CONFIGURATION
 A__				= PRETRAINED_POSITIONAL_EMBEDDINGS_SIZES
 A__				= ElectraTokenizer
 def __init__(   self						:							Optional[Any]      ,     __a						:							List[str]=None      ,     __a						:							List[Any]=None      ,     __a						:							Tuple=True      ,     __a						:							Tuple="[UNK]"      ,     __a						:							Optional[int]="[SEP]"      ,     __a						:							Optional[int]="[PAD]"      ,     __a						:							Union[str, Any]="[CLS]"      ,     __a						:							Optional[int]="[MASK]"      ,     __a						:							Optional[Any]=True      ,     __a						:							Optional[int]=None      ,     **__a						:							Optional[Any]      ,     )      ->   str:







       '''simple docstring'''
       super().__init__(
           _lowerCAmelCase      ,     tokenizer_file=_lowerCAmelCase      ,     do_lower_case=_lowerCAmelCase      ,     unk_token=_lowerCAmelCase      ,     sep_token=_lowerCAmelCase      ,     pad_token=_lowerCAmelCase      ,     cls_token=_lowerCAmelCase      ,     mask_token=_lowerCAmelCase      ,     tokenize_chinese_chars=_lowerCAmelCase      ,     strip_accents=_lowerCAmelCase      ,     **_lowerCAmelCase      ,     )

       __snake_case :   Optional[int]													=    json.loads(self.backend_tokenizer.normalizer.__getstate__()  )
       if (
           normalizer_state.get('lowercase'      ,     _lowerCAmelCase  ) != do_lower_case
           or normalizer_state.get('strip_accents'      ,     _lowerCAmelCase  ) != strip_accents
           or normalizer_state.get('handle_chinese_chars'      ,     _lowerCAmelCase  ) != tokenize_chinese_chars
       ):
             __snake_case :   List[Any]													=    getattr(_lowerCAmelCase      ,     normalizer_state.pop('type'  )  )
             __snake_case :   Optional[Any]													=    do_lower_case
             __snake_case :   int													=    strip_accents
             __snake_case :   Optional[int]													=    tokenize_chinese_chars
             __snake_case :   Optional[int]													=    normalizer_class(**_lowerCAmelCase  )

       __snake_case :   Union[str, Any]													=    do_lower_case
 def A_   (   self						:							Any      ,     __a						:							Optional[int]      ,     __a						:							List[Any]=None  )      ->   Tuple:







       '''simple docstring'''
       __snake_case :   Tuple													=    [self.cls_token_id] + token_ids_a + [self.sep_token_id]

       if token_ids_a:
             output += token_ids_a + [self.sep_token_id]

       return output
 def A_   (   self						:							Optional[int]      ,     __a						:							Optional[int]      ,     __a						:							List[str] = None  )      ->   Union[str, Any]:







       '''simple docstring'''
       __snake_case :   Dict													=    [self.sep_token_id]
       __snake_case :   Union[str, Any]													=    [self.cls_token_id]
       if token_ids_a is None:
             return len(cls + token_ids_a + sep  ) * [0]
       return len(cls + token_ids_a + sep  ) * [0] + len(token_ids_a + sep  ) * [1]





 def A_   (   self						:							Optional[int]      ,     __a						:							Tuple      ,     __a						:							Dict = None  )      ->   Optional[int]:







       '''simple docstring'''
       __snake_case :   List[str]													=    self._tokenizer.model.save(_lowerCAmelCase      ,     name=_lowerCAmelCase  )
       return tuple(_lowerCAmelCase  )










from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional, Union

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


if TYPE_CHECKING:
							from ... import FeatureExtractionMixin, PreTrainedTokenizerBase, TensorType


lowerCAmelCase							:       Tuple					 =	logging.get_logger(__name__)

lowerCAmelCase							:       List[Any]					 =	{
    """microsoft/deberta-v2-xlarge""": """https://huggingface.co/microsoft/deberta-v2-xlarge/resolve/main/config.json""",
    """microsoft/deberta-v2-xxlarge""": """https://huggingface.co/microsoft/deberta-v2-xxlarge/resolve/main/config.json""",
    """microsoft/deberta-v2-xlarge-mnli""": (
        """https://huggingface.co/microsoft/deberta-v2-xlarge-mnli/resolve/main/config.json"""
    ),
    """microsoft/deberta-v2-xxlarge-mnli""": (
        """https://huggingface.co/microsoft/deberta-v2-xxlarge-mnli/resolve/main/config.json"""
    ),
}





class 				a			(      __lowercase			):
				SCREAMING_SNAKE_CASE__     :   str		      =     '''deberta-v2'''






				def __init__(  self			, _lowerCAmelCase=128100			, _lowerCAmelCase=1536			, _lowerCAmelCase=24			, _lowerCAmelCase=24			, _lowerCAmelCase=6144			, _lowerCAmelCase="gelu"			, _lowerCAmelCase=0.1			, _lowerCAmelCase=0.1			, _lowerCAmelCase=512			, _lowerCAmelCase=0			, _lowerCAmelCase=0.02			, _lowerCAmelCase=1e-7			, _lowerCAmelCase=False			, _lowerCAmelCase=-1			, _lowerCAmelCase=0			, _lowerCAmelCase=True			, _lowerCAmelCase=None			, _lowerCAmelCase=0			, _lowerCAmelCase="gelu"			, **_lowerCAmelCase			, ):

										"""simple docstring"""




										super().__init__(**_lowerCAmelCase					)

										__SCREAMING_SNAKE_CASE:				Union[str, Any]           =   hidden_size
										__SCREAMING_SNAKE_CASE:				Tuple           =   num_hidden_layers
										__SCREAMING_SNAKE_CASE:				str           =   num_attention_heads
										__SCREAMING_SNAKE_CASE:				List[Any]           =   intermediate_size
										__SCREAMING_SNAKE_CASE:				str           =   hidden_act
										__SCREAMING_SNAKE_CASE:				Dict           =   hidden_dropout_prob
										__SCREAMING_SNAKE_CASE:				Optional[int]           =   attention_probs_dropout_prob
										__SCREAMING_SNAKE_CASE:				Dict           =   max_position_embeddings
										__SCREAMING_SNAKE_CASE:				Optional[int]           =   type_vocab_size
										__SCREAMING_SNAKE_CASE:				str           =   initializer_range
										__SCREAMING_SNAKE_CASE:				Any           =   relative_attention
										__SCREAMING_SNAKE_CASE:				Tuple           =   max_relative_positions
										__SCREAMING_SNAKE_CASE:				List[str]           =   pad_token_id
										__SCREAMING_SNAKE_CASE:				List[str]           =   position_biased_input

										# Backwards compatibility
										if type(_lowerCAmelCase					) == str:
																__SCREAMING_SNAKE_CASE:				str           =   [x.strip() for x in pos_att_type.lower().split('''|'''					)]

										__SCREAMING_SNAKE_CASE:				int           =   pos_att_type
										__SCREAMING_SNAKE_CASE:				List[Any]           =   vocab_size
										__SCREAMING_SNAKE_CASE:				List[str]           =   layer_norm_eps

										__SCREAMING_SNAKE_CASE:				Optional[int]           =   kwargs.get('''pooler_hidden_size'''			, _lowerCAmelCase					)
										__SCREAMING_SNAKE_CASE:				Dict           =   pooler_dropout
										__SCREAMING_SNAKE_CASE:				int           =   pooler_hidden_act





class 				a			(      __lowercase			):






				@property
				def 			snake_case_    (  self					):

										"""simple docstring"""




										if self.task == "multiple-choice":
																__SCREAMING_SNAKE_CASE:				Any           =   {0: '''batch''', 1: '''choice''', 2: '''sequence'''}
										else:
																__SCREAMING_SNAKE_CASE:				Any           =   {0: '''batch''', 1: '''sequence'''}
										if self._config.type_vocab_size > 0:
																return OrderedDict(
																    [('''input_ids''', dynamic_axis), ('''attention_mask''', dynamic_axis), ('''token_type_ids''', dynamic_axis)]					)
										else:
																return OrderedDict([('''input_ids''', dynamic_axis), ('''attention_mask''', dynamic_axis)]					)






				@property
				def 			snake_case_    (  self					):

										"""simple docstring"""




										return 12






				def 			snake_case_    (  self			, _lowerCAmelCase			, _lowerCAmelCase = -1			, _lowerCAmelCase = -1			, _lowerCAmelCase = -1			, _lowerCAmelCase = False			, _lowerCAmelCase = None			, _lowerCAmelCase = 3			, _lowerCAmelCase = 40			, _lowerCAmelCase = 40			, _lowerCAmelCase = None			, ):

										"""simple docstring"""




										__SCREAMING_SNAKE_CASE:				str           =   super().generate_dummy_inputs(preprocessor=_lowerCAmelCase			, framework=_lowerCAmelCase					)
										if self._config.type_vocab_size == 0 and "token_type_ids" in dummy_inputs:
																del dummy_inputs["token_type_ids"]
										return dummy_inputs



