


import functools
import operator

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


SCREAMING_SNAKE_CASE							    =							logging.get_logger(__name__)

SCREAMING_SNAKE_CASE							    =							{
    'microsoft/wavlm-base': 'https://huggingface.co/microsoft/wavlm-base/resolve/main/config.json',
    # See all WavLM models at https://huggingface.co/models?filter=wavlm
}


class     __UpperCAmelCase							(       __A							):


     """simple docstring"""
     _lowerCamelCase   =      """wavlm"""


     def __init__(	self  ,       __A=32  ,       __A=768  ,       __A=12  ,       __A=12  ,       __A=3072  ,       __A="gelu"  ,       __A=0.1  ,       __A=0.1  ,       __A=0.1  ,       __A=0.0  ,       __A=0.1  ,       __A=0.1  ,       __A=0.02  ,       __A=1E-5  ,       __A="group"  ,       __A="gelu"  ,       __A=(512, 512, 512, 512, 512, 512, 512)  ,       __A=(5, 2, 2, 2, 2, 2, 2)  ,       __A=(10, 3, 3, 3, 3, 2, 2)  ,       __A=False  ,       __A=128  ,       __A=16  ,       __A=320  ,       __A=800  ,       __A=False  ,       __A=True  ,       __A=0.05  ,       __A=10  ,       __A=2  ,       __A=0.0  ,       __A=10  ,       __A=320  ,       __A=2  ,       __A=0.1  ,       __A=100  ,       __A=256  ,       __A=256  ,       __A=0.1  ,       __A="mean"  ,       __A=False  ,       __A=False  ,       __A=256  ,       __A=(512, 512, 512, 512, 1500)  ,       __A=(5, 3, 3, 1, 1)  ,       __A=(1, 2, 3, 1, 1)  ,       __A=512  ,       __A=80  ,       __A=0  ,       __A=1  ,       __A=2  ,       __A=False  ,       __A=3  ,       __A=2  ,       __A=3  ,       __A=None  ,       **__A  ,       ):
        super().__init__(**__UpperCAmelCase  ,       pad_token_id=__UpperCAmelCase  ,       bos_token_id=__UpperCAmelCase  ,       eos_token_id=__UpperCAmelCase    )
        __a					=  hidden_size
        __a					=  feat_extract_norm
        __a					=  feat_extract_activation
        __a					=  list(__UpperCAmelCase    )
        __a					=  list(__UpperCAmelCase    )
        __a					=  list(__UpperCAmelCase    )
        __a					=  conv_bias
        __a					=  num_buckets
        __a					=  max_bucket_distance
        __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

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

        # ctc loss
        __a					=  ctc_loss_reduction
        __a					=  ctc_zero_infinity

        # adapter
        __a					=  add_adapter
        __a					=  adapter_kernel_size
        __a					=  adapter_stride
        __a					=  num_adapter_layers
        __a					=  output_hidden_size or hidden_size

        # SequenceClassification-specific parameter. Feel free to ignore for other classes.
        __a					=  classifier_proj_size

        # XVector-specific parameters. Feel free to ignore for other classes.
        __a					=  list(__UpperCAmelCase    )
        __a					=  list(__UpperCAmelCase    )
        __a					=  list(__UpperCAmelCase    )
        __a					=  xvector_output_dim


     @property
     def 	snake_case_  (	self    ):
        return functools.reduce(operator.mul  ,       self.conv_stride  ,       1    )










"""simple docstring"""





from collections import OrderedDict
from typing import TYPE_CHECKING, Any, Mapping, Optional, Union

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


if TYPE_CHECKING:
  from ... import FeatureExtractionMixin, PreTrainedTokenizerBase, TensorType


__A											=						logging.get_logger(__name__)

__A											=						{
    """microsoft/deberta-v2-xlarge""": """https://huggingface.co/microsoft/deberta-v2-xlarge/resolve/main/config.json""",
    """microsoft/deberta-v2-xxlarge""": """https://huggingface.co/microsoft/deberta-v2-xxlarge/resolve/main/config.json""",
    """microsoft/deberta-v2-xlarge-mnli""": (
        """https://huggingface.co/microsoft/deberta-v2-xlarge-mnli/resolve/main/config.json"""
    ),
    """microsoft/deberta-v2-xxlarge-mnli""": (
        """https://huggingface.co/microsoft/deberta-v2-xxlarge-mnli/resolve/main/config.json"""
    ),
}






class    _lowerCAmelCase  (	a			):
       """simple docstring"""




       __magic_name__	:Union[str, Any]						    =   """deberta-v2"""






       def __init__(       self       ,					__UpperCAmelCase=1_2_8_1_0_0       ,					__UpperCAmelCase=1_5_3_6       ,					__UpperCAmelCase=2_4       ,					__UpperCAmelCase=2_4       ,					__UpperCAmelCase=6_1_4_4       ,					__UpperCAmelCase="gelu"       ,					__UpperCAmelCase=0.1       ,					__UpperCAmelCase=0.1       ,					__UpperCAmelCase=5_1_2       ,					__UpperCAmelCase=0       ,					__UpperCAmelCase=0.02       ,					__UpperCAmelCase=1E-7       ,					__UpperCAmelCase=False       ,					__UpperCAmelCase=-1       ,					__UpperCAmelCase=0       ,					__UpperCAmelCase=True       ,					__UpperCAmelCase=None       ,					__UpperCAmelCase=0       ,					__UpperCAmelCase="gelu"       ,					**__UpperCAmelCase       ,					):



         '''simple docstring'''

         super().__init__(**__UpperCAmelCase )

         lowerCAmelCase__     :Optional[int]											=				hidden_size
         lowerCAmelCase__     :Optional[int]											=				num_hidden_layers
         lowerCAmelCase__     :Optional[int]											=				num_attention_heads
         lowerCAmelCase__     :int											=				intermediate_size
         lowerCAmelCase__     :Dict											=				hidden_act
         lowerCAmelCase__     :Tuple											=				hidden_dropout_prob
         lowerCAmelCase__     :Optional[int]											=				attention_probs_dropout_prob
         lowerCAmelCase__     :Optional[Any]											=				max_position_embeddings
         lowerCAmelCase__     :Optional[Any]											=				type_vocab_size
         lowerCAmelCase__     :List[Any]											=				initializer_range
         lowerCAmelCase__     :Dict											=				relative_attention
         lowerCAmelCase__     :Union[str, Any]											=				max_relative_positions
         lowerCAmelCase__     :List[str]											=				pad_token_id
         lowerCAmelCase__     :Optional[int]											=				position_biased_input

         # Backwards compatibility
         if type(__UpperCAmelCase ) == str:
           lowerCAmelCase__     :Dict											=				[x.strip() for x in pos_att_type.lower().split('|' )]

         lowerCAmelCase__     :str											=				pos_att_type
         lowerCAmelCase__     :Dict											=				vocab_size
         lowerCAmelCase__     :Tuple											=				layer_norm_eps

         lowerCAmelCase__     :Optional[Any]											=				kwargs.get('pooler_hidden_size'       ,					__UpperCAmelCase )
         lowerCAmelCase__     :Union[str, Any]											=				pooler_dropout
         lowerCAmelCase__     :int											=				pooler_hidden_act






class    _lowerCAmelCase  (	a			):
       """simple docstring"""




       @property
       def 	snake_case		(       self ):



         '''simple docstring'''

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






       @property
       def 	snake_case		(       self ):



         '''simple docstring'''

         return 1_2






       def 	snake_case		(       self       ,					__UpperCAmelCase       ,					__UpperCAmelCase = -1       ,					__UpperCAmelCase = -1       ,					__UpperCAmelCase = -1       ,					__UpperCAmelCase = False       ,					__UpperCAmelCase = None       ,					__UpperCAmelCase = 3       ,					__UpperCAmelCase = 4_0       ,					__UpperCAmelCase = 4_0       ,					__UpperCAmelCase = None       ,					):



         '''simple docstring'''

         lowerCAmelCase__     :Union[str, Any]											=				super().generate_dummy_inputs(preprocessor=__UpperCAmelCase       ,					framework=__UpperCAmelCase )
         if self._config.type_vocab_size == 0 and "token_type_ids" in dummy_inputs:
           del dummy_inputs["token_type_ids"]
         return dummy_inputs
