






"""simple docstring"""







from collections import OrderedDict
from typing import Mapping

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


a :				Optional[int]      					=		logging.get_logger(__name__)

a :				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     __UpperCAmelCase(   SCREAMING_SNAKE_CASE__							):




						"""simple docstring"""




						__lowerCamelCase				       =					"electra"




						def __init__(   self       ,  snake_case__=30522       ,  snake_case__=128       ,  snake_case__=256       ,  snake_case__=12       ,  snake_case__=4       ,  snake_case__=1024       ,  snake_case__="gelu"       ,  snake_case__=0.1       ,  snake_case__=0.1       ,  snake_case__=512       ,  snake_case__=2       ,  snake_case__=0.02       ,  snake_case__=1e-12       ,  snake_case__="first"       ,  snake_case__=True       ,  snake_case__="gelu"       ,  snake_case__=0.1       ,  snake_case__=0       ,  snake_case__="absolute"       ,  snake_case__=True       ,  snake_case__=None       ,  **snake_case__       ,  ):
												'''simple docstring'''
												super().__init__(pad_token_id=snake_case__       ,  **snake_case__			)

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

												lowercase__				:      Optional[int]=       summary_type
												lowercase__				:      Union[str, Any]=       summary_use_proj
												lowercase__				:      str=       summary_activation
												lowercase__				:      List[str]=       summary_last_dropout
												lowercase__				:      List[str]=       position_embedding_type
												lowercase__				:      Tuple=       use_cache
												lowercase__				:      Tuple=       classifier_dropout


class     __UpperCAmelCase(   SCREAMING_SNAKE_CASE__							):




						"""simple docstring"""




						@property
						def 		UpperCAmelCase_       (   self			):
												'''simple docstring'''
												if self.task == "multiple-choice":
																		lowercase__				:      int=       {0: "batch", 1: "choice", 2: "sequence"}
												else:
																		lowercase__				:      int=       {0: "batch", 1: "sequence"}
												return OrderedDict(
												    [
												        ("input_ids", dynamic_axis),
												        ("attention_mask", dynamic_axis),
												        ("token_type_ids", dynamic_axis),
												    ]			)














"""simple docstring"""







import importlib.metadata
import subprocess
import sys





def 						lowercase__(A = False						)				->List[str]:




						"""simple docstring"""



						lowercase__				:      Any=       False
						if "IPython" in sys.modules:
												lowercase__				:      Tuple=       "google.colab" in str(sys.modules["IPython"].get_ipython()						)

						if in_colab:
												if upgrade:
																		lowercase__				:      Optional[int]=       ["pip", "install", "-U", "torch"]
																		subprocess.run(A					,		check=A						)
												# get the current version of torch
												lowercase__				:      Tuple=       importlib.metadata.version("torch"						)
												lowercase__				:      Dict=       torch_version[: torch_version.rindex("."						)]
												lowercase__				:      Dict=       f'''https://storage.googleapis.com/tpu-pytorch/wheels/colab/torch_xla-{torch_version_trunc}-cp37-cp37m-linux_x86_64.whl'''
												lowercase__				:      Union[str, Any]=       ["pip", "install", xla_wheel]
												subprocess.run(A					,		check=A						)
						else:
												raise RuntimeError("`install_xla` utility works only on google colab."						)






