






"""simple docstring"""



import functools
import operator

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


A__	:    int			 = logging.get_logger(__name__)

A__	:    str			 = {
    '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__       ):
			_UpperCAmelCase		:List[Any]             =			"wavlm"


			def __init__(				self					:  Dict       ,	snake_case__					:  List[str]=32       ,	snake_case__					:  Optional[Any]=768       ,	snake_case__					:  List[str]=12       ,	snake_case__					:  Optional[Any]=12       ,	snake_case__					:  Dict=3072       ,	snake_case__					:  Optional[int]="gelu"       ,	snake_case__					:  Any=0.1       ,	snake_case__					:  Union[str, Any]=0.1       ,	snake_case__					:  Union[str, Any]=0.1       ,	snake_case__					:  str=0.0       ,	snake_case__					:  int=0.1       ,	snake_case__					:  Optional[Any]=0.1       ,	snake_case__					:  str=0.02       ,	snake_case__					:  Dict=1E-5       ,	snake_case__					:  Optional[Any]="group"       ,	snake_case__					:  int="gelu"       ,	snake_case__					:  Optional[Any]=(512, 512, 512, 512, 512, 512, 512)       ,	snake_case__					:  Tuple=(5, 2, 2, 2, 2, 2, 2)       ,	snake_case__					:  Dict=(10, 3, 3, 3, 3, 2, 2)       ,	snake_case__					:  Optional[int]=False       ,	snake_case__					:  Any=128       ,	snake_case__					:  List[Any]=16       ,	snake_case__					:  List[str]=320       ,	snake_case__					:  Union[str, Any]=800       ,	snake_case__					:  Any=False       ,	snake_case__					:  Any=True       ,	snake_case__					:  str=0.05       ,	snake_case__					:  Dict=10       ,	snake_case__					:  Dict=2       ,	snake_case__					:  Optional[Any]=0.0       ,	snake_case__					:  List[Any]=10       ,	snake_case__					:  Dict=320       ,	snake_case__					:  List[Any]=2       ,	snake_case__					:  Any=0.1       ,	snake_case__					:  List[Any]=100       ,	snake_case__					:  str=256       ,	snake_case__					:  List[Any]=256       ,	snake_case__					:  Tuple=0.1       ,	snake_case__					:  Union[str, Any]="mean"       ,	snake_case__					:  Any=False       ,	snake_case__					:  str=False       ,	snake_case__					:  Optional[Any]=256       ,	snake_case__					:  int=(512, 512, 512, 512, 1500)       ,	snake_case__					:  Optional[Any]=(5, 3, 3, 1, 1)       ,	snake_case__					:  List[Any]=(1, 2, 3, 1, 1)       ,	snake_case__					:  int=512       ,	snake_case__					:  Any=80       ,	snake_case__					:  Dict=0       ,	snake_case__					:  Dict=1       ,	snake_case__					:  Union[str, Any]=2       ,	snake_case__					:  Tuple=False       ,	snake_case__					:  Union[str, Any]=3       ,	snake_case__					:  Optional[Any]=2       ,	snake_case__					:  Union[str, Any]=3       ,	snake_case__					:  Optional[int]=None       ,	**snake_case__					:  Union[str, Any]       ,	):
										super().__init__(**snake_case__       ,	pad_token_id=snake_case__       ,	bos_token_id=snake_case__       ,	eos_token_id=snake_case__ )
										lowerCamelCase_	:							Optional[Any]									=hidden_size
										lowerCamelCase_	:							Optional[Any]									=feat_extract_norm
										lowerCamelCase_	:							List[str]									=feat_extract_activation
										lowerCamelCase_	:							Optional[int]									=list(snake_case__ )
										lowerCamelCase_	:							Tuple									=list(snake_case__ )
										lowerCamelCase_	:							int									=list(snake_case__ )
										lowerCamelCase_	:							int									=conv_bias
										lowerCamelCase_	:							Any									=num_buckets
										lowerCamelCase_	:							Dict									=max_bucket_distance
										lowerCamelCase_	:							Any									=num_conv_pos_embeddings
										lowerCamelCase_	:							str									=num_conv_pos_embedding_groups
										lowerCamelCase_	:							List[Any]									=len(self.conv_dim )
										lowerCamelCase_	:							Dict									=num_hidden_layers
										lowerCamelCase_	:							int									=intermediate_size
										lowerCamelCase_	:							Dict									=hidden_act
										lowerCamelCase_	:							Dict									=num_attention_heads
										lowerCamelCase_	:							Dict									=hidden_dropout
										lowerCamelCase_	:							int									=attention_dropout
										lowerCamelCase_	:							List[str]									=activation_dropout
										lowerCamelCase_	:							Optional[int]									=feat_proj_dropout
										lowerCamelCase_	:							int									=final_dropout
										lowerCamelCase_	:							Tuple									=layerdrop
										lowerCamelCase_	:							str									=layer_norm_eps
										lowerCamelCase_	:							Optional[int]									=initializer_range
										lowerCamelCase_	:							Any									=num_ctc_classes
										lowerCamelCase_	:							Any									=vocab_size
										lowerCamelCase_	:							str									=do_stable_layer_norm
										lowerCamelCase_	:							Union[str, Any]									=use_weighted_layer_sum
										lowerCamelCase_	:							Tuple									=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_	:							Optional[Any]									=apply_spec_augment
										lowerCamelCase_	:							str									=mask_time_prob
										lowerCamelCase_	:							List[Any]									=mask_time_length
										lowerCamelCase_	:							Optional[int]									=mask_time_min_masks
										lowerCamelCase_	:							int									=mask_feature_prob
										lowerCamelCase_	:							Optional[int]									=mask_feature_length

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

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

										# adapter
										lowerCamelCase_	:							Dict									=add_adapter
										lowerCamelCase_	:							Dict									=adapter_kernel_size
										lowerCamelCase_	:							Optional[Any]									=adapter_stride
										lowerCamelCase_	:							List[Any]									=num_adapter_layers
										lowerCamelCase_	:							Optional[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_	:							Any									=list(snake_case__ )
										lowerCamelCase_	:							Optional[Any]									=xvector_output_dim


			@property
			def      UpperCAmelCase__						(				self					:  List[Any] ):
										return functools.reduce(operator.mul       ,	self.conv_stride       ,	1 )











"""simple docstring"""



from typing import TYPE_CHECKING

from ..utils import _LazyModule


A__	:    List[str]			 = {
    'config': [
        'EXTERNAL_DATA_FORMAT_SIZE_LIMIT',
        'OnnxConfig',
        'OnnxConfigWithPast',
        'OnnxSeq2SeqConfigWithPast',
        'PatchingSpec',
    ],
    'convert': ['export', 'validate_model_outputs'],
    'features': ['FeaturesManager'],
    'utils': ['ParameterFormat', 'compute_serialized_parameters_size'],
}


if TYPE_CHECKING:
						from .config import (
						    EXTERNAL_DATA_FORMAT_SIZE_LIMIT,
						    OnnxConfig,
						    OnnxConfigWithPast,
						    OnnxSeqaSeqConfigWithPast,
						    PatchingSpec,
						)
						from .convert import export, validate_model_outputs
						from .features import FeaturesManager
						from .utils import ParameterFormat, compute_serialized_parameters_size

else:
						import sys

						A__	:    List[str]			 = _LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



