





from collections import OrderedDict
from typing import Mapping

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


UpperCAmelCase_      							=     logging.get_logger(__name__)

UpperCAmelCase_      							=     {
    "YituTech/conv-bert-base": "https://huggingface.co/YituTech/conv-bert-base/resolve/main/config.json",
    "YituTech/conv-bert-medium-small": (
        "https://huggingface.co/YituTech/conv-bert-medium-small/resolve/main/config.json"
    ),
    "YituTech/conv-bert-small": "https://huggingface.co/YituTech/conv-bert-small/resolve/main/config.json",
    # See all ConvBERT models at https://huggingface.co/models?filter=convbert
}
class 			UpperCamelCase_		(  UpperCamelCase_					):
					lowerCAmelCase_							=	"""convbert"""




					def __init__(		self				,						lowerCAmelCase_=3_0522				,						lowerCAmelCase_=768				,						lowerCAmelCase_=12				,						lowerCAmelCase_=12				,						lowerCAmelCase_=3072				,						lowerCAmelCase_="gelu"				,						lowerCAmelCase_=0.1				,						lowerCAmelCase_=0.1				,						lowerCAmelCase_=512				,						lowerCAmelCase_=2				,						lowerCAmelCase_=0.02				,						lowerCAmelCase_=1E-12				,						lowerCAmelCase_=1				,						lowerCAmelCase_=0				,						lowerCAmelCase_=2				,						lowerCAmelCase_=768				,						lowerCAmelCase_=2				,						lowerCAmelCase_=9				,						lowerCAmelCase_=1				,						lowerCAmelCase_=None				,						**lowerCAmelCase_				,						)		->							Dict:
										super().__init__(
										    pad_token_id=_a				,						bos_token_id=_a				,						eos_token_id=_a				,						**_a				,						)

										_snake_case									=				vocab_size
										_snake_case									=				hidden_size
										_snake_case									=				num_hidden_layers
										_snake_case									=				num_attention_heads
										_snake_case									=				intermediate_size
										_snake_case									=				hidden_act
										_snake_case									=				hidden_dropout_prob
										_snake_case									=				attention_probs_dropout_prob
										_snake_case									=				max_position_embeddings
										_snake_case									=				type_vocab_size
										_snake_case									=				initializer_range
										_snake_case									=				layer_norm_eps
										_snake_case									=				embedding_size
										_snake_case									=				head_ratio
										_snake_case									=				conv_kernel_size
										_snake_case									=				num_groups
										_snake_case									=				classifier_dropout





class 			UpperCamelCase_		(  UpperCamelCase_					):




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


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










from collections import deque

from .hash_table import HashTable
class 			UpperCamelCase_		(  _lowerCamelCase					):




					def __init__(		self				,						*lowerCAmelCase_				,						**lowerCAmelCase_  )		->							Any:
										super().__init__(*lowerCAmelCase_				,						**lowerCAmelCase_  )




					def 	lowerCAmelCase			(		self				,						lowerCAmelCase_				,						lowerCAmelCase_  )		->							Optional[int]:
										_snake_case									=				deque([]  ) if self.values[key] is None else self.values[key]
										self.values[key].appendleft(lowerCAmelCase_  )
										_snake_case									=				self.values[key]




					def 	lowerCAmelCase			(		self  )		->							Optional[int]:
										return (
										    sum(self.charge_factor - len(lowerCAmelCase_  ) for slot in self.values  )
										    / self.size_table
										    * self.charge_factor
										)






					def 	lowerCAmelCase			(		self				,						lowerCAmelCase_				,						lowerCAmelCase_=None  )		->							str:
										if not (
										    len(self.values[key]  ) == self.charge_factor and self.values.count(lowerCAmelCase_  ) == 0
										):
															return key
										return super()._collision_resolution(lowerCAmelCase_				,						lowerCAmelCase_  )



