


'''simple docstring'''



from collections import OrderedDict
from typing import Mapping

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


__UpperCAmelCase     :List[Any]												=  logging.get_logger(__name__)

__UpperCAmelCase     :int												=  {
    "google/electra-small-generator": "https://huggingface.co/google/electra-small-generator/resolve/main/config.json",
    "google/electra-base-generator": "https://huggingface.co/google/electra-base-generator/resolve/main/config.json",
    "google/electra-large-generator": "https://huggingface.co/google/electra-large-generator/resolve/main/config.json",
    "google/electra-small-discriminator": (
        "https://huggingface.co/google/electra-small-discriminator/resolve/main/config.json"
    ),
    "google/electra-base-discriminator": (
        "https://huggingface.co/google/electra-base-discriminator/resolve/main/config.json"
    ),
    "google/electra-large-discriminator": (
        "https://huggingface.co/google/electra-large-discriminator/resolve/main/config.json"
    ),
}



class       a							(						_a			):


     """simple docstring"""






     SCREAMING_SNAKE_CASE			:					List[Any]				  =  "electra"

     def __init__(							self	:						List[str]				,					snake_case	:						Union[str, Any]=3_0522				,					snake_case	:						Union[str, Any]=128				,					snake_case	:						int=256				,					snake_case	:						Tuple=12				,					snake_case	:						List[str]=4				,					snake_case	:						Union[str, Any]=1024				,					snake_case	:						Any="gelu"				,					snake_case	:						Dict=0.1				,					snake_case	:						Tuple=0.1				,					snake_case	:						List[Any]=512				,					snake_case	:						Optional[int]=2				,					snake_case	:						int=0.02				,					snake_case	:						Optional[int]=1E-12				,					snake_case	:						Dict="first"				,					snake_case	:						Optional[Any]=True				,					snake_case	:						List[str]="gelu"				,					snake_case	:						int=0.1				,					snake_case	:						Any=0				,					snake_case	:						Any="absolute"				,					snake_case	:						Any=True				,					snake_case	:						Any=None				,					**snake_case	:						Tuple				,					)		->				Dict:
          super().__init__(pad_token_id=snake_case				,					**snake_case     )

          __UpperCAmelCase      :					Tuple    				=     vocab_size
          __UpperCAmelCase      :					Optional[int]    				=     embedding_size
          __UpperCAmelCase      :					Dict    				=     hidden_size
          __UpperCAmelCase      :					Any    				=     num_hidden_layers
          __UpperCAmelCase      :					List[Any]    				=     num_attention_heads
          __UpperCAmelCase      :					Optional[Any]    				=     intermediate_size
          __UpperCAmelCase      :					Optional[Any]    				=     hidden_act
          __UpperCAmelCase      :					str    				=     hidden_dropout_prob
          __UpperCAmelCase      :					Optional[int]    				=     attention_probs_dropout_prob
          __UpperCAmelCase      :					List[str]    				=     max_position_embeddings
          __UpperCAmelCase      :					List[str]    				=     type_vocab_size
          __UpperCAmelCase      :					Tuple    				=     initializer_range
          __UpperCAmelCase      :					Any    				=     layer_norm_eps

          __UpperCAmelCase      :					Optional[int]    				=     summary_type
          __UpperCAmelCase      :					List[str]    				=     summary_use_proj
          __UpperCAmelCase      :					Dict    				=     summary_activation
          __UpperCAmelCase      :					List[str]    				=     summary_last_dropout
          __UpperCAmelCase      :					Dict    				=     position_embedding_type
          __UpperCAmelCase      :					str    				=     use_cache
          __UpperCAmelCase      :					Optional[int]    				=     classifier_dropout



class       a							(						_a			):


     """simple docstring"""






     @property
     def 					lowerCamelCase__					(							self	:						str     )		->				Mapping[str, Mapping[int, str]]:
          if self.task == "multiple-choice":
               __UpperCAmelCase      :					Any    				=     {0: '''batch''', 1: '''choice''', 2: '''sequence'''}
          else:
               __UpperCAmelCase      :					Any    				=     {0: '''batch''', 1: '''sequence'''}
          return OrderedDict(
              [
                  ('''input_ids''', dynamic_axis),
                  ('''attention_mask''', dynamic_axis),
                  ('''token_type_ids''', dynamic_axis),
              ]     )



'''simple docstring'''



import unittest
import warnings
from dataclasses import dataclass

from transformers.convert_slow_tokenizer import SpmConverter
from transformers.testing_utils import get_tests_dir



@dataclass
class       a							:


     """simple docstring"""






     SCREAMING_SNAKE_CASE			:					str



class       a							(						unittest.TestCase			):


     """simple docstring"""






     def 					lowerCamelCase__					(							self	:						str     )		->				Dict:
          __UpperCAmelCase      :					str    				=     get_tests_dir('''fixtures/test_sentencepiece.model'''     )
          __UpperCAmelCase      :					List[Any]    				=     get_tests_dir('''fixtures/test_sentencepiece_with_bytefallback.model'''     )

          __UpperCAmelCase      :					Tuple    				=     FakeOriginalTokenizer(vocab_file=snake_case     )

          with warnings.catch_warnings(record=snake_case     ) as w:
               __UpperCAmelCase      :					Optional[int]    				=     SpmConverter(snake_case     )
          self.assertEqual(len(snake_case     )				,					0     )

          __UpperCAmelCase      :					str    				=     FakeOriginalTokenizer(vocab_file=snake_case     )

          with warnings.catch_warnings(record=snake_case     ) as w:
               __UpperCAmelCase      :					Optional[int]    				=     SpmConverter(snake_case     )
          self.assertEqual(len(snake_case     )				,					1     )

          self.assertIn(
              '''The sentencepiece tokenizer that you are converting to a fast tokenizer uses the byte fallback option'''
              ''' which is not implemented in the fast tokenizers.'''				,					str(w[0].message     )				,					)