

"""simple docstring"""




from collections import OrderedDict
from typing import Mapping

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


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

A_							:     Optional[Any]     =	{
    "google/mobilebert-uncased": "https://huggingface.co/google/mobilebert-uncased/resolve/main/config.json"
}





class 				lowerCamelCase  (__lowerCamelCase     ):
			lowerCamelCase__				:						Optional[Any]   						=							MOBILEBERT_PRETRAINED_CONFIG_ARCHIVE_MAP
			lowerCamelCase__				:						Tuple   						=							"mobilebert"

			def __init__(   self			:  Union[str, Any]      ,			__UpperCAmelCase			:  List[Any]=3_0_5_2_2      ,			__UpperCAmelCase			:  Any=5_1_2      ,			__UpperCAmelCase			:  List[str]=2_4      ,			__UpperCAmelCase			:  Optional[Any]=4      ,			__UpperCAmelCase			:  Optional[int]=5_1_2      ,			__UpperCAmelCase			:  str="relu"      ,			__UpperCAmelCase			:  int=0.0      ,			__UpperCAmelCase			:  Dict=0.1      ,			__UpperCAmelCase			:  List[str]=5_1_2      ,			__UpperCAmelCase			:  List[str]=2      ,			__UpperCAmelCase			:  Any=0.02      ,			__UpperCAmelCase			:  Optional[Any]=1e-12      ,			__UpperCAmelCase			:  int=0      ,			__UpperCAmelCase			:  Union[str, Any]=1_2_8      ,			__UpperCAmelCase			:  Optional[Any]=True      ,			__UpperCAmelCase			:  List[Any]=True      ,			__UpperCAmelCase			:  Tuple=1_2_8      ,			__UpperCAmelCase			:  Tuple=False      ,			__UpperCAmelCase			:  Tuple=True      ,			__UpperCAmelCase			:  str=4      ,			__UpperCAmelCase			:  Any="no_norm"      ,			__UpperCAmelCase			:  str=True      ,			__UpperCAmelCase			:  int=None      ,			**__UpperCAmelCase			:  Optional[Any]      ,			)				->      Dict:
						super().__init__(pad_token_id=_UpperCamelCase      ,			**_UpperCamelCase    )

						SCREAMING_SNAKE_CASE__									= vocab_size
						SCREAMING_SNAKE_CASE__									= hidden_size
						SCREAMING_SNAKE_CASE__									= num_hidden_layers
						SCREAMING_SNAKE_CASE__									= num_attention_heads
						SCREAMING_SNAKE_CASE__									= hidden_act
						SCREAMING_SNAKE_CASE__									= intermediate_size
						SCREAMING_SNAKE_CASE__									= hidden_dropout_prob
						SCREAMING_SNAKE_CASE__									= attention_probs_dropout_prob
						SCREAMING_SNAKE_CASE__									= max_position_embeddings
						SCREAMING_SNAKE_CASE__									= type_vocab_size
						SCREAMING_SNAKE_CASE__									= initializer_range
						SCREAMING_SNAKE_CASE__									= layer_norm_eps
						SCREAMING_SNAKE_CASE__									= embedding_size
						SCREAMING_SNAKE_CASE__									= trigram_input
						SCREAMING_SNAKE_CASE__									= use_bottleneck
						SCREAMING_SNAKE_CASE__									= intra_bottleneck_size
						SCREAMING_SNAKE_CASE__									= use_bottleneck_attention
						SCREAMING_SNAKE_CASE__									= key_query_shared_bottleneck
						SCREAMING_SNAKE_CASE__									= num_feedforward_networks
						SCREAMING_SNAKE_CASE__									= normalization_type
						SCREAMING_SNAKE_CASE__									= classifier_activation

						if self.use_bottleneck:
									SCREAMING_SNAKE_CASE__									= intra_bottleneck_size
						else:
									SCREAMING_SNAKE_CASE__									= hidden_size

						SCREAMING_SNAKE_CASE__									= classifier_dropout





class 				lowerCamelCase  (__lowerCamelCase     ):

			@property
			def    SCREAMING_SNAKE_CASE			(   self			:  List[Any]    )				->      Mapping[str, Mapping[int, str]]:





						if self.task == "multiple-choice":
									SCREAMING_SNAKE_CASE__									= {0: """batch""", 1: """choice""", 2: """sequence"""}
						else:
									SCREAMING_SNAKE_CASE__									= {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 		A    (       snake_case__ = False      ):




			'''simple docstring'''


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

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


