






import functools
import operator

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


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

__lowerCamelCase	:		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   (   _A						):
      _a							:						List[Any]										=							'wavlm'
      def __init__(     self				,			a=3_2				,			a=7_6_8				,			a=1_2				,			a=1_2				,			a=3_0_7_2				,			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=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)				,			a=(5, 2, 2, 2, 2, 2, 2)				,			a=(1_0, 3, 3, 3, 3, 2, 2)				,			a=False				,			a=1_2_8				,			a=1_6				,			a=3_2_0				,			a=8_0_0				,			a=False				,			a=True				,			a=0.05				,			a=1_0				,			a=2				,			a=0.0				,			a=1_0				,			a=3_2_0				,			a=2				,			a=0.1				,			a=1_0_0				,			a=2_5_6				,			a=2_5_6				,			a=0.1				,			a="mean"				,			a=False				,			a=False				,			a=2_5_6				,			a=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)				,			a=(5, 3, 3, 1, 1)				,			a=(1, 2, 3, 1, 1)				,			a=5_1_2				,			a=8_0				,			a=0				,			a=1				,			a=2				,			a=False				,			a=3				,			a=2				,			a=3				,			a=None				,			**a				,			):
       super().__init__(**a				,			pad_token_id=a				,			bos_token_id=a				,			eos_token_id=a   )
       snake_case__  :    int							       =hidden_size
       snake_case__  :    Dict							       =feat_extract_norm
       snake_case__  :    Any							       =feat_extract_activation
       snake_case__  :    Dict							       =list(a   )
       snake_case__  :    str							       =list(a   )
       snake_case__  :    List[str]							       =list(a   )
       snake_case__  :    Optional[Any]							       =conv_bias
       snake_case__  :    List[str]							       =num_buckets
       snake_case__  :    Optional[int]							       =max_bucket_distance
       snake_case__  :    str							       =num_conv_pos_embeddings
       snake_case__  :    str							       =num_conv_pos_embedding_groups
       snake_case__  :    str							       =len(self.conv_dim   )
       snake_case__  :    Optional[Any]							       =num_hidden_layers
       snake_case__  :    int							       =intermediate_size
       snake_case__  :    Optional[Any]							       =hidden_act
       snake_case__  :    List[Any]							       =num_attention_heads
       snake_case__  :    List[Any]							       =hidden_dropout
       snake_case__  :    List[str]							       =attention_dropout
       snake_case__  :    Any							       =activation_dropout
       snake_case__  :    Any							       =feat_proj_dropout
       snake_case__  :    Optional[int]							       =final_dropout
       snake_case__  :    Optional[Any]							       =layerdrop
       snake_case__  :    Dict							       =layer_norm_eps
       snake_case__  :    Optional[int]							       =initializer_range
       snake_case__  :    List[str]							       =num_ctc_classes
       snake_case__  :    Tuple							       =vocab_size
       snake_case__  :    Tuple							       =do_stable_layer_norm
       snake_case__  :    str							       =use_weighted_layer_sum
       snake_case__  :    str							       =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
       snake_case__  :    Optional[int]							       =apply_spec_augment
       snake_case__  :    List[str]							       =mask_time_prob
       snake_case__  :    List[Any]							       =mask_time_length
       snake_case__  :    Any							       =mask_time_min_masks
       snake_case__  :    str							       =mask_feature_prob
       snake_case__  :    Dict							       =mask_feature_length

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

       # ctc loss
       snake_case__  :    Any							       =ctc_loss_reduction
       snake_case__  :    Tuple							       =ctc_zero_infinity

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

       # SequenceClassification-specific parameter. Feel free to ignore for other classes.
       snake_case__  :    Optional[Any]							       =classifier_proj_size

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



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













class  _lowercase   :
      def __init__(     self				,			a   ):
       snake_case__  :    Optional[int]							       =size
       snake_case__  :    List[Any]							       =[0] * size
       snake_case__  :    List[Any]							       =[0] * size
      @staticmethod
      def 						lowercase__					(     a   ):
       return index | (index + 1)
      @staticmethod
      def 						lowercase__					(     a   ):
       return (index & (index + 1)) - 1
      def 						lowercase__					(     self				,			a				,			a   ):
       snake_case__  :    Optional[Any]							       =value
       while index < self.size:
        snake_case__  :    str							       =self.get_prev(a   ) + 1
        if current_left_border == index:
         snake_case__  :    Dict							       =value
        else:
         snake_case__  :    str							       =max(a				,			a				,			a   )
        snake_case__  :    Dict							       =self.get_next(a   )



      def 						lowercase__					(     self				,			a				,			a   ):
       right -= 1  # Because of right is exclusive
       snake_case__  :    Union[str, Any]							       =0
       while left <= right:
        snake_case__  :    List[str]							       =self.get_prev(a   )
        if left <= current_left:
         snake_case__  :    Optional[Any]							       =max(a				,			self.tree[right]   )
         snake_case__  :    Optional[Any]							       =current_left
        else:
         snake_case__  :    Tuple							       =max(a				,			self.arr[right]   )
         right -= 1
       return result


if __name__ == "__main__":
       import doctest

       doctest.testmod()





