



"""simple docstring"""







import functools
import operator

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


lowercase__		:				List[str]          =	logging.get_logger(__name__)

lowercase__		:				List[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       UpperCamelCase__   (	A_  ):




      """simple docstring"""




      _SCREAMING_SNAKE_CASE  				=     "wavlm"



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

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

        # ctc loss
        lowerCAmelCase_   :				Any								= ctc_loss_reduction
        lowerCAmelCase_   :				Optional[Any]								= ctc_zero_infinity

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

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

        # XVector-specific parameters. Feel free to ignore for other classes.
        lowerCAmelCase_   :				int								= list(_snake_case       )
        lowerCAmelCase_   :				List[Any]								= list(_snake_case       )
        lowerCAmelCase_   :				str								= list(_snake_case       )
        lowerCAmelCase_   :				Dict								= xvector_output_dim





      @property
      def      SCREAMING_SNAKE_CASE__ (      self				:      Union[str, Any]       ):
        return functools.reduce(operator.mul    ,			self.conv_stride    ,			1       )










"""simple docstring"""







import unittest

from accelerate import debug_launcher
from accelerate.test_utils import require_cpu, test_ops, test_script
@require_cpu
class        __A       (	unittest.TestCase    ):







		'''simple docstring'''





		def 					UpperCAmelCase    (	self						:  Optional[int]						)					->		str:






				"""simple docstring"""



				debug_launcher(test_script.main						)







		def 					UpperCAmelCase    (	self						:  Dict						)					->		Tuple:






				"""simple docstring"""



				debug_launcher(test_ops.main						)
