


import functools
import operator

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


A      :    str		=					logging.get_logger(__name__)

A      :    Optional[Any]		=					{
    "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 (							snake_case_):


       """simple docstring"""




       A__											=			"wavlm"





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


             '''simple docstring'''



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

             # parameters for pretraining with codevector quantized representations
             lowerCamelCase__		:				Any    =  num_codevectors_per_group
             lowerCamelCase__		:				int    =  num_codevector_groups
             lowerCamelCase__		:				List[Any]    =  contrastive_logits_temperature
             lowerCamelCase__		:				str    =  num_negatives
             lowerCamelCase__		:				int    =  codevector_dim
             lowerCamelCase__		:				Tuple    =  proj_codevector_dim
             lowerCamelCase__		:				int    =  diversity_loss_weight

             # ctc loss
             lowerCamelCase__		:				int    =  ctc_loss_reduction
             lowerCamelCase__		:				int    =  ctc_zero_infinity

             # adapter
             lowerCamelCase__		:				Any    =  add_adapter
             lowerCamelCase__		:				str    =  adapter_kernel_size
             lowerCamelCase__		:				str    =  adapter_stride
             lowerCamelCase__		:				Tuple    =  num_adapter_layers
             lowerCamelCase__		:				Union[str, Any]    =  output_hidden_size or hidden_size

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

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





       @property
       def 						lowerCAmelCase     (   self							:			str       ):


             '''simple docstring'''



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










from __future__ import annotations





def 						__UpperCAmelCase			(     a_							,     a_							,     a_							,     a_):  # noqa: E741
							while r - l > 1:
														snake_case_				=							(l + r) // 2
														if v[m] >= key:
																					snake_case_				=							m
														else:
																					snake_case_				=							m  # noqa: E741
							return r





def 						__UpperCAmelCase			(     a_):
							if len(a_) == 0:
														return 0

							snake_case_				=							[0] * len(a_)
							snake_case_				=							1

							snake_case_				=							v[0]

							for i in range(1							,     len(a_)):
														if v[i] < tail[0]:
																					snake_case_				=							v[i]
														elif v[i] > tail[length - 1]:
																					snake_case_				=							v[i]
																					length += 1
														else:
																					snake_case_				=							v[i]

							return length


if __name__ == "__main__":
	import doctest

	doctest.testmod()





