


import functools
import operator

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


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

lowerCAmelCase__			:      Tuple								={
    '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 	__lowercase    (__SCREAMING_SNAKE_CASE  ):





							"""simple docstring"""







							_UpperCAmelCase      =						"""wavlm"""






							def __init__(      self			,						lowerCAmelCase__=3_2			,						lowerCAmelCase__=7_6_8			,						lowerCAmelCase__=1_2			,						lowerCAmelCase__=1_2			,						lowerCAmelCase__=3_0_7_2			,						lowerCAmelCase__="gelu"			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=0.0			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=0.02			,						lowerCAmelCase__=1E-5			,						lowerCAmelCase__="group"			,						lowerCAmelCase__="gelu"			,						lowerCAmelCase__=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)			,						lowerCAmelCase__=(5, 2, 2, 2, 2, 2, 2)			,						lowerCAmelCase__=(1_0, 3, 3, 3, 3, 2, 2)			,						lowerCAmelCase__=False			,						lowerCAmelCase__=1_2_8			,						lowerCAmelCase__=1_6			,						lowerCAmelCase__=3_2_0			,						lowerCAmelCase__=8_0_0			,						lowerCAmelCase__=False			,						lowerCAmelCase__=True			,						lowerCAmelCase__=0.05			,						lowerCAmelCase__=1_0			,						lowerCAmelCase__=2			,						lowerCAmelCase__=0.0			,						lowerCAmelCase__=1_0			,						lowerCAmelCase__=3_2_0			,						lowerCAmelCase__=2			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__=1_0_0			,						lowerCAmelCase__=2_5_6			,						lowerCAmelCase__=2_5_6			,						lowerCAmelCase__=0.1			,						lowerCAmelCase__="mean"			,						lowerCAmelCase__=False			,						lowerCAmelCase__=False			,						lowerCAmelCase__=2_5_6			,						lowerCAmelCase__=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)			,						lowerCAmelCase__=(5, 3, 3, 1, 1)			,						lowerCAmelCase__=(1, 2, 3, 1, 1)			,						lowerCAmelCase__=5_1_2			,						lowerCAmelCase__=8_0			,						lowerCAmelCase__=0			,						lowerCAmelCase__=1			,						lowerCAmelCase__=2			,						lowerCAmelCase__=False			,						lowerCAmelCase__=3			,						lowerCAmelCase__=2			,						lowerCAmelCase__=3			,						lowerCAmelCase__=None			,						**lowerCAmelCase__			,						):





										"""simple docstring"""




										super().__init__(**lowerCAmelCase__			,						pad_token_id=lowerCAmelCase__			,						bos_token_id=lowerCAmelCase__			,						eos_token_id=lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     str					=					hidden_size
										SCREAMING_SNAKE_CASE_		:     List[str]					=					feat_extract_norm
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					feat_extract_activation
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					list(lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     List[str]					=					list(lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     Any					=					list(lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					conv_bias
										SCREAMING_SNAKE_CASE_		:     Any					=					num_buckets
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					max_bucket_distance
										SCREAMING_SNAKE_CASE_		:     Any					=					num_conv_pos_embeddings
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					num_conv_pos_embedding_groups
										SCREAMING_SNAKE_CASE_		:     Dict					=					len(self.conv_dim       )
										SCREAMING_SNAKE_CASE_		:     Tuple					=					num_hidden_layers
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					intermediate_size
										SCREAMING_SNAKE_CASE_		:     Tuple					=					hidden_act
										SCREAMING_SNAKE_CASE_		:     Tuple					=					num_attention_heads
										SCREAMING_SNAKE_CASE_		:     int					=					hidden_dropout
										SCREAMING_SNAKE_CASE_		:     Dict					=					attention_dropout
										SCREAMING_SNAKE_CASE_		:     int					=					activation_dropout
										SCREAMING_SNAKE_CASE_		:     List[str]					=					feat_proj_dropout
										SCREAMING_SNAKE_CASE_		:     int					=					final_dropout
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					layerdrop
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					layer_norm_eps
										SCREAMING_SNAKE_CASE_		:     Tuple					=					initializer_range
										SCREAMING_SNAKE_CASE_		:     List[str]					=					num_ctc_classes
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					vocab_size
										SCREAMING_SNAKE_CASE_		:     str					=					do_stable_layer_norm
										SCREAMING_SNAKE_CASE_		:     int					=					use_weighted_layer_sum
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					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
										SCREAMING_SNAKE_CASE_		:     Any					=					apply_spec_augment
										SCREAMING_SNAKE_CASE_		:     Tuple					=					mask_time_prob
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					mask_time_length
										SCREAMING_SNAKE_CASE_		:     Tuple					=					mask_time_min_masks
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					mask_feature_prob
										SCREAMING_SNAKE_CASE_		:     Dict					=					mask_feature_length

										# parameters for pretraining with codevector quantized representations
										SCREAMING_SNAKE_CASE_		:     str					=					num_codevectors_per_group
										SCREAMING_SNAKE_CASE_		:     Dict					=					num_codevector_groups
										SCREAMING_SNAKE_CASE_		:     str					=					contrastive_logits_temperature
										SCREAMING_SNAKE_CASE_		:     Tuple					=					num_negatives
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					codevector_dim
										SCREAMING_SNAKE_CASE_		:     Optional[int]					=					proj_codevector_dim
										SCREAMING_SNAKE_CASE_		:     str					=					diversity_loss_weight

										# ctc loss
										SCREAMING_SNAKE_CASE_		:     Any					=					ctc_loss_reduction
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					ctc_zero_infinity

										# adapter
										SCREAMING_SNAKE_CASE_		:     Dict					=					add_adapter
										SCREAMING_SNAKE_CASE_		:     Dict					=					adapter_kernel_size
										SCREAMING_SNAKE_CASE_		:     Tuple					=					adapter_stride
										SCREAMING_SNAKE_CASE_		:     List[Any]					=					num_adapter_layers
										SCREAMING_SNAKE_CASE_		:     int					=					output_hidden_size or hidden_size

										# SequenceClassification-specific parameter. Feel free to ignore for other classes.
										SCREAMING_SNAKE_CASE_		:     List[str]					=					classifier_proj_size

										# XVector-specific parameters. Feel free to ignore for other classes.
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					list(lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     Union[str, Any]					=					list(lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     int					=					list(lowerCAmelCase__       )
										SCREAMING_SNAKE_CASE_		:     Optional[Any]					=					xvector_output_dim






							@property
							def 					UpperCamelCase__     (      self       ):





										"""simple docstring"""




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







"""simple docstring"""



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


a       :						Dict       		=		logging.get_logger(__name__)

# TODO: upload to AWS
a       :						Tuple       		=		{
    '''yjernite/retribert-base-uncased''': (
        '''https://huggingface.co/yjernite/retribert-base-uncased/resolve/main/config.json'''
    ),
}




class 		a_    (			_UpperCAmelCase						):
    a   :					int			     =					'retribert'







    def __init__(      self      :							Optional[Any]  ,       __UpperCamelCase      :							Optional[Any]=3_05_22  ,       __UpperCamelCase      :							int=7_68  ,       __UpperCamelCase      :							Any=8  ,       __UpperCamelCase      :							Dict=12  ,       __UpperCamelCase      :							List[Any]=30_72  ,       __UpperCamelCase      :							List[Any]="gelu"  ,       __UpperCamelCase      :							Optional[int]=0.1  ,       __UpperCamelCase      :							int=0.1  ,       __UpperCamelCase      :							Union[str, Any]=5_12  ,       __UpperCamelCase      :							Dict=2  ,       __UpperCamelCase      :							Tuple=0.0_2  ,       __UpperCamelCase      :							List[str]=1e-12  ,       __UpperCamelCase      :							int=True  ,       __UpperCamelCase      :							str=1_28  ,       __UpperCamelCase      :							Union[str, Any]=0  ,       **__UpperCamelCase      :							Any  ,       )		->List[Any]:






        '''simple docstring'''






        super().__init__(pad_token_id=__UpperCamelCase  ,       **__UpperCamelCase  )

        _UpperCAmelCase        = vocab_size
        _UpperCAmelCase        = hidden_size
        _UpperCAmelCase        = num_hidden_layers
        _UpperCAmelCase        = num_attention_heads
        _UpperCAmelCase        = hidden_act
        _UpperCAmelCase        = intermediate_size
        _UpperCAmelCase        = hidden_dropout_prob
        _UpperCAmelCase        = attention_probs_dropout_prob
        _UpperCAmelCase        = max_position_embeddings
        _UpperCAmelCase        = type_vocab_size
        _UpperCAmelCase        = initializer_range
        _UpperCAmelCase        = layer_norm_eps
        _UpperCAmelCase        = share_encoders
        _UpperCAmelCase        = projection_dim