import functools
import operator

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


UpperCAmelCase_								=       logging.get_logger(__name__)

UpperCAmelCase_								=       {
    '''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      lowerCAmelCase						(					__A			):
     _SCREAMING_SNAKE_CASE     :     Optional[Any]		="""unispeech"""



     def __init__(					self				,      lowerCAmelCase__=32				,      lowerCAmelCase__=768				,      lowerCAmelCase__=12				,      lowerCAmelCase__=12				,      lowerCAmelCase__=3072				,      lowerCAmelCase__="gelu"				,      lowerCAmelCase__=0.1				,      lowerCAmelCase__=0.1				,      lowerCAmelCase__=0.1				,      lowerCAmelCase__=0.0				,      lowerCAmelCase__=0.0				,      lowerCAmelCase__=0.1				,      lowerCAmelCase__=0.1				,      lowerCAmelCase__=0.02				,      lowerCAmelCase__=1E-5				,      lowerCAmelCase__="group"				,      lowerCAmelCase__="gelu"				,      lowerCAmelCase__=(512, 512, 512, 512, 512, 512, 512)				,      lowerCAmelCase__=(5, 2, 2, 2, 2, 2, 2)				,      lowerCAmelCase__=(10, 3, 3, 3, 3, 2, 2)				,      lowerCAmelCase__=False				,      lowerCAmelCase__=128				,      lowerCAmelCase__=16				,      lowerCAmelCase__=False				,      lowerCAmelCase__=True				,      lowerCAmelCase__=0.05				,      lowerCAmelCase__=10				,      lowerCAmelCase__=2				,      lowerCAmelCase__=0.0				,      lowerCAmelCase__=10				,      lowerCAmelCase__=0				,      lowerCAmelCase__=320				,      lowerCAmelCase__=2				,      lowerCAmelCase__=0.1				,      lowerCAmelCase__=100				,      lowerCAmelCase__=256				,      lowerCAmelCase__=256				,      lowerCAmelCase__=0.1				,      lowerCAmelCase__="mean"				,      lowerCAmelCase__=False				,      lowerCAmelCase__=False				,      lowerCAmelCase__=256				,      lowerCAmelCase__=80				,      lowerCAmelCase__=0				,      lowerCAmelCase__=1				,      lowerCAmelCase__=2				,      lowerCAmelCase__=0.5				,      **lowerCAmelCase__				,      ):
            super().__init__(**lowerCAmelCase__				,      pad_token_id=lowerCAmelCase__				,      bos_token_id=lowerCAmelCase__				,      eos_token_id=lowerCAmelCase__       )
            _A=	hidden_size
            _A=	feat_extract_norm
            _A=	feat_extract_activation
            _A=	list(lowerCAmelCase__       )
            _A=	list(lowerCAmelCase__       )
            _A=	list(lowerCAmelCase__       )
            _A=	conv_bias
            _A=	num_conv_pos_embeddings
            _A=	num_conv_pos_embedding_groups
            _A=	len(self.conv_dim       )
            _A=	num_hidden_layers
            _A=	intermediate_size
            _A=	hidden_act
            _A=	num_attention_heads
            _A=	hidden_dropout
            _A=	attention_dropout
            _A=	activation_dropout
            _A=	feat_proj_dropout
            _A=	final_dropout
            _A=	layerdrop
            _A=	layer_norm_eps
            _A=	initializer_range
            _A=	num_ctc_classes
            _A=	vocab_size
            _A=	do_stable_layer_norm
            _A=	use_weighted_layer_sum
            _A=	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
            _A=	apply_spec_augment
            _A=	mask_time_prob
            _A=	mask_time_length
            _A=	mask_time_min_masks
            _A=	mask_feature_prob
            _A=	mask_feature_length
            _A=	mask_feature_min_masks

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

            # ctc loss
            _A=	ctc_loss_reduction
            _A=	ctc_zero_infinity

            # pretraining loss
            _A=	replace_prob





     @property
     def 			a__  (					self       ):
            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


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      lowerCAmelCase						(					_a			):
     _SCREAMING_SNAKE_CASE     :     List[str]		="""convbert"""



     def __init__(					self				,      lowerCAmelCase__=30522				,      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__				,      ):
            super().__init__(
                pad_token_id=lowerCAmelCase__				,      bos_token_id=lowerCAmelCase__				,      eos_token_id=lowerCAmelCase__				,      **lowerCAmelCase__				,      )

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





class      lowerCAmelCase						(					_a			):



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