


import functools
import operator

from ...configuration_utils import PretrainedConfig
from ...utils import logging


A	:		Union[str, Any]    =       logging.get_logger(__name__)

A	:		Optional[int]    =       {
    'microsoft/unispeech-large-1500h-cv': (
        'https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config.json'
    ),
    # See all UniSpeech models at https://huggingface.co/models?filter=unispeech
}



class 							A   (	UpperCAmelCase__							):
					'''simple docstring'''






					A__      =			'''unispeech'''

					def __init__(self   :						int				, _UpperCAmelCase   :						str=32				, _UpperCAmelCase   :						int=768				, _UpperCAmelCase   :						str=12				, _UpperCAmelCase   :						Tuple=12				, _UpperCAmelCase   :						Union[str, Any]=3072				, _UpperCAmelCase   :						Dict="gelu"				, _UpperCAmelCase   :						Any=0.1				, _UpperCAmelCase   :						Dict=0.1				, _UpperCAmelCase   :						Union[str, Any]=0.1				, _UpperCAmelCase   :						str=0.0				, _UpperCAmelCase   :						Optional[int]=0.0				, _UpperCAmelCase   :						Dict=0.1				, _UpperCAmelCase   :						Optional[Any]=0.1				, _UpperCAmelCase   :						Dict=0.02				, _UpperCAmelCase   :						Tuple=1E-5				, _UpperCAmelCase   :						Any="group"				, _UpperCAmelCase   :						int="gelu"				, _UpperCAmelCase   :						Dict=(512, 512, 512, 512, 512, 512, 512)				, _UpperCAmelCase   :						int=(5, 2, 2, 2, 2, 2, 2)				, _UpperCAmelCase   :						Union[str, Any]=(10, 3, 3, 3, 3, 2, 2)				, _UpperCAmelCase   :						Optional[Any]=False				, _UpperCAmelCase   :						Tuple=128				, _UpperCAmelCase   :						Optional[Any]=16				, _UpperCAmelCase   :						List[Any]=False				, _UpperCAmelCase   :						int=True				, _UpperCAmelCase   :						Optional[Any]=0.05				, _UpperCAmelCase   :						int=10				, _UpperCAmelCase   :						str=2				, _UpperCAmelCase   :						Union[str, Any]=0.0				, _UpperCAmelCase   :						Optional[int]=10				, _UpperCAmelCase   :						Optional[Any]=0				, _UpperCAmelCase   :						Dict=320				, _UpperCAmelCase   :						Optional[int]=2				, _UpperCAmelCase   :						Tuple=0.1				, _UpperCAmelCase   :						Tuple=100				, _UpperCAmelCase   :						Optional[int]=256				, _UpperCAmelCase   :						Optional[int]=256				, _UpperCAmelCase   :						Optional[Any]=0.1				, _UpperCAmelCase   :						Any="mean"				, _UpperCAmelCase   :						Optional[Any]=False				, _UpperCAmelCase   :						int=False				, _UpperCAmelCase   :						Any=256				, _UpperCAmelCase   :						Union[str, Any]=80				, _UpperCAmelCase   :						Union[str, Any]=0				, _UpperCAmelCase   :						Any=1				, _UpperCAmelCase   :						List[str]=2				, _UpperCAmelCase   :						Any=0.5				, **_UpperCAmelCase   :						Any				, )						->       Union[str, Any]:




							"""simple docstring"""


							super().__init__(**_UpperCAmelCase				, pad_token_id=_UpperCAmelCase				, bos_token_id=_UpperCAmelCase				, eos_token_id=_UpperCAmelCase		)
							lowercase__					      =		hidden_size
							lowercase__					      =		feat_extract_norm
							lowercase__					      =		feat_extract_activation
							lowercase__					      =		list(_UpperCAmelCase		)
							lowercase__					      =		list(_UpperCAmelCase		)
							lowercase__					      =		list(_UpperCAmelCase		)
							lowercase__					      =		conv_bias
							lowercase__					      =		num_conv_pos_embeddings
							lowercase__					      =		num_conv_pos_embedding_groups
							lowercase__					      =		len(self.conv_dim		)
							lowercase__					      =		num_hidden_layers
							lowercase__					      =		intermediate_size
							lowercase__					      =		hidden_act
							lowercase__					      =		num_attention_heads
							lowercase__					      =		hidden_dropout
							lowercase__					      =		attention_dropout
							lowercase__					      =		activation_dropout
							lowercase__					      =		feat_proj_dropout
							lowercase__					      =		final_dropout
							lowercase__					      =		layerdrop
							lowercase__					      =		layer_norm_eps
							lowercase__					      =		initializer_range
							lowercase__					      =		num_ctc_classes
							lowercase__					      =		vocab_size
							lowercase__					      =		do_stable_layer_norm
							lowercase__					      =		use_weighted_layer_sum
							lowercase__					      =		classifier_proj_size

							if (
							    (len(self.conv_stride		) != self.num_feat_extract_layers)
							    or (len(self.conv_kernel		) != self.num_feat_extract_layers)
							    or (len(self.conv_dim		) != self.num_feat_extract_layers)
							):
									raise ValueError(
									    """Configuration for convolutional layers is incorrect. It is required that `len(config.conv_dim)` =="""
									    """ `len(config.conv_stride)` == `len(config.conv_kernel)`, but is `len(config.conv_dim) ="""
									    f''' {len(self.conv_dim		)}`, `len(config.conv_stride) = {len(self.conv_stride		)}`,'''
									    f''' `len(config.conv_kernel) = {len(self.conv_kernel		)}`.'''		)

							# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
							lowercase__					      =		apply_spec_augment
							lowercase__					      =		mask_time_prob
							lowercase__					      =		mask_time_length
							lowercase__					      =		mask_time_min_masks
							lowercase__					      =		mask_feature_prob
							lowercase__					      =		mask_feature_length
							lowercase__					      =		mask_feature_min_masks

							# parameters for pretraining with codevector quantized representations
							lowercase__					      =		num_codevectors_per_group
							lowercase__					      =		num_codevector_groups
							lowercase__					      =		contrastive_logits_temperature
							lowercase__					      =		feat_quantizer_dropout
							lowercase__					      =		num_negatives
							lowercase__					      =		codevector_dim
							lowercase__					      =		proj_codevector_dim
							lowercase__					      =		diversity_loss_weight

							# ctc loss
							lowercase__					      =		ctc_loss_reduction
							lowercase__					      =		ctc_zero_infinity

							# pretraining loss
							lowercase__					      =		replace_prob


					@property
					def   lowerCamelCase__					(self   :						Optional[int]		)						->       List[str]:




							"""simple docstring"""


							return functools.reduce(operator.mul				, self.conv_stride				, 1		)





from collections import OrderedDict
from typing import Mapping

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


A	:		Optional[Any]    =       logging.get_logger(__name__)

A	:		Tuple    =       {
    '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 							A   (	UpperCAmelCase__							):
					'''simple docstring'''






					A__      =			'''convbert'''

					def __init__(self   :						str				, _UpperCAmelCase   :						Union[str, Any]=3_0522				, _UpperCAmelCase   :						Dict=768				, _UpperCAmelCase   :						Optional[int]=12				, _UpperCAmelCase   :						List[str]=12				, _UpperCAmelCase   :						str=3072				, _UpperCAmelCase   :						Tuple="gelu"				, _UpperCAmelCase   :						Optional[int]=0.1				, _UpperCAmelCase   :						int=0.1				, _UpperCAmelCase   :						str=512				, _UpperCAmelCase   :						Dict=2				, _UpperCAmelCase   :						int=0.02				, _UpperCAmelCase   :						Tuple=1E-1_2				, _UpperCAmelCase   :						Dict=1				, _UpperCAmelCase   :						Optional[Any]=0				, _UpperCAmelCase   :						List[str]=2				, _UpperCAmelCase   :						str=768				, _UpperCAmelCase   :						List[Any]=2				, _UpperCAmelCase   :						Optional[Any]=9				, _UpperCAmelCase   :						List[Any]=1				, _UpperCAmelCase   :						Union[str, Any]=None				, **_UpperCAmelCase   :						List[Any]				, )						->       List[str]:




							"""simple docstring"""


							super().__init__(
							    pad_token_id=_UpperCAmelCase				, bos_token_id=_UpperCAmelCase				, eos_token_id=_UpperCAmelCase				, **_UpperCAmelCase				, )

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






class 							A   (	UpperCAmelCase__							):
					'''simple docstring'''






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




							"""simple docstring"""


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

