"""simple docstring"""
import functools
import operator

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


SCREAMING_SNAKE_CASE__   =					logging.get_logger(__name__)

SCREAMING_SNAKE_CASE__   =					{
    "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 					lowerCAmelCase_      (     lowerCAmelCase   ):



				"""simple docstring"""
				_lowerCAmelCase       :      Tuple     					=  """wavlm"""

				def __init__(			self						,      lowerCAmelCase=32						,      lowerCAmelCase=7_68						,      lowerCAmelCase=12						,      lowerCAmelCase=12						,      lowerCAmelCase=30_72						,      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_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)						,      lowerCAmelCase=(5, 2, 2, 2, 2, 2, 2)						,      lowerCAmelCase=(10, 3, 3, 3, 3, 2, 2)						,      lowerCAmelCase=False						,      lowerCAmelCase=1_28						,      lowerCAmelCase=16						,      lowerCAmelCase=3_20						,      lowerCAmelCase=8_00						,      lowerCAmelCase=False						,      lowerCAmelCase=True						,      lowerCAmelCase=0.05						,      lowerCAmelCase=10						,      lowerCAmelCase=2						,      lowerCAmelCase=0.0						,      lowerCAmelCase=10						,      lowerCAmelCase=3_20						,      lowerCAmelCase=2						,      lowerCAmelCase=0.1						,      lowerCAmelCase=1_00						,      lowerCAmelCase=2_56						,      lowerCAmelCase=2_56						,      lowerCAmelCase=0.1						,      lowerCAmelCase="mean"						,      lowerCAmelCase=False						,      lowerCAmelCase=False						,      lowerCAmelCase=2_56						,      lowerCAmelCase=(5_12, 5_12, 5_12, 5_12, 15_00)						,      lowerCAmelCase=(5, 3, 3, 1, 1)						,      lowerCAmelCase=(1, 2, 3, 1, 1)						,      lowerCAmelCase=5_12						,      lowerCAmelCase=80						,      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      )
										snake_case        =     hidden_size
										snake_case        =     feat_extract_norm
										snake_case        =     feat_extract_activation
										snake_case        =     list(lowerCAmelCase      )
										snake_case        =     list(lowerCAmelCase      )
										snake_case        =     list(lowerCAmelCase      )
										snake_case        =     conv_bias
										snake_case        =     num_buckets
										snake_case        =     max_bucket_distance
										snake_case        =     num_conv_pos_embeddings
										snake_case        =     num_conv_pos_embedding_groups
										snake_case        =     len(self.conv_dim      )
										snake_case        =     num_hidden_layers
										snake_case        =     intermediate_size
										snake_case        =     hidden_act
										snake_case        =     num_attention_heads
										snake_case        =     hidden_dropout
										snake_case        =     attention_dropout
										snake_case        =     activation_dropout
										snake_case        =     feat_proj_dropout
										snake_case        =     final_dropout
										snake_case        =     layerdrop
										snake_case        =     layer_norm_eps
										snake_case        =     initializer_range
										snake_case        =     num_ctc_classes
										snake_case        =     vocab_size
										snake_case        =     do_stable_layer_norm
										snake_case        =     use_weighted_layer_sum
										snake_case        =     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        =     apply_spec_augment
										snake_case        =     mask_time_prob
										snake_case        =     mask_time_length
										snake_case        =     mask_time_min_masks
										snake_case        =     mask_feature_prob
										snake_case        =     mask_feature_length

										# parameters for pretraining with codevector quantized representations
										snake_case        =     num_codevectors_per_group
										snake_case        =     num_codevector_groups
										snake_case        =     contrastive_logits_temperature
										snake_case        =     num_negatives
										snake_case        =     codevector_dim
										snake_case        =     proj_codevector_dim
										snake_case        =     diversity_loss_weight

										# ctc loss
										snake_case        =     ctc_loss_reduction
										snake_case        =     ctc_zero_infinity

										# adapter
										snake_case        =     add_adapter
										snake_case        =     adapter_kernel_size
										snake_case        =     adapter_stride
										snake_case        =     num_adapter_layers
										snake_case        =     output_hidden_size or hidden_size

										# SequenceClassification-specific parameter. Feel free to ignore for other classes.
										snake_case        =     classifier_proj_size

										# XVector-specific parameters. Feel free to ignore for other classes.
										snake_case        =     list(lowerCAmelCase      )
										snake_case        =     list(lowerCAmelCase      )
										snake_case        =     list(lowerCAmelCase      )
										snake_case        =     xvector_output_dim

				@property
				def 						snake_case	(			self      ):






										"""simple docstring"""

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



"""simple docstring"""
from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_tf_available, is_torch_available


SCREAMING_SNAKE_CASE__   =					{
    "configuration_data2vec_audio": ["DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP", "Data2VecAudioConfig"],
    "configuration_data2vec_text": [
        "DATA2VEC_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "Data2VecTextConfig",
        "Data2VecTextOnnxConfig",
    ],
    "configuration_data2vec_vision": [
        "DATA2VEC_VISION_PRETRAINED_CONFIG_ARCHIVE_MAP",
        "Data2VecVisionConfig",
        "Data2VecVisionOnnxConfig",
    ],
}

try:
					if not is_torch_available():
										raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
					pass
else:
					SCREAMING_SNAKE_CASE__   =					[
					    "DATA2VEC_AUDIO_PRETRAINED_MODEL_ARCHIVE_LIST",
					    "Data2VecAudioForAudioFrameClassification",
					    "Data2VecAudioForCTC",
					    "Data2VecAudioForSequenceClassification",
					    "Data2VecAudioForXVector",
					    "Data2VecAudioModel",
					    "Data2VecAudioPreTrainedModel",
					]
					SCREAMING_SNAKE_CASE__   =					[
					    "DATA2VEC_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST",
					    "Data2VecTextForCausalLM",
					    "Data2VecTextForMaskedLM",
					    "Data2VecTextForMultipleChoice",
					    "Data2VecTextForQuestionAnswering",
					    "Data2VecTextForSequenceClassification",
					    "Data2VecTextForTokenClassification",
					    "Data2VecTextModel",
					    "Data2VecTextPreTrainedModel",
					]
					SCREAMING_SNAKE_CASE__   =					[
					    "DATA2VEC_VISION_PRETRAINED_MODEL_ARCHIVE_LIST",
					    "Data2VecVisionForImageClassification",
					    "Data2VecVisionForMaskedImageModeling",
					    "Data2VecVisionForSemanticSegmentation",
					    "Data2VecVisionModel",
					    "Data2VecVisionPreTrainedModel",
					]

if is_tf_available():
					SCREAMING_SNAKE_CASE__   =					[
					    "TFData2VecVisionForImageClassification",
					    "TFData2VecVisionForSemanticSegmentation",
					    "TFData2VecVisionModel",
					    "TFData2VecVisionPreTrainedModel",
					]

if TYPE_CHECKING:
					from .configuration_dataavec_audio import DATA2VEC_AUDIO_PRETRAINED_CONFIG_ARCHIVE_MAP, DataaVecAudioConfig
					from .configuration_dataavec_text import (
					    DATA2VEC_TEXT_PRETRAINED_CONFIG_ARCHIVE_MAP,
					    DataaVecTextConfig,
					    DataaVecTextOnnxConfig,
					)
					from .configuration_dataavec_vision import (
					    DATA2VEC_VISION_PRETRAINED_CONFIG_ARCHIVE_MAP,
					    DataaVecVisionConfig,
					    DataaVecVisionOnnxConfig,
					)

					try:
										if not is_torch_available():
															raise OptionalDependencyNotAvailable()
					except OptionalDependencyNotAvailable:
										pass
					else:
										from .modeling_dataavec_audio import (
										    DATA2VEC_AUDIO_PRETRAINED_MODEL_ARCHIVE_LIST,
										    DataaVecAudioForAudioFrameClassification,
										    DataaVecAudioForCTC,
										    DataaVecAudioForSequenceClassification,
										    DataaVecAudioForXVector,
										    DataaVecAudioModel,
										    DataaVecAudioPreTrainedModel,
										)
										from .modeling_dataavec_text import (
										    DATA2VEC_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST,
										    DataaVecTextForCausalLM,
										    DataaVecTextForMaskedLM,
										    DataaVecTextForMultipleChoice,
										    DataaVecTextForQuestionAnswering,
										    DataaVecTextForSequenceClassification,
										    DataaVecTextForTokenClassification,
										    DataaVecTextModel,
										    DataaVecTextPreTrainedModel,
										)
										from .modeling_dataavec_vision import (
										    DATA2VEC_VISION_PRETRAINED_MODEL_ARCHIVE_LIST,
										    DataaVecVisionForImageClassification,
										    DataaVecVisionForMaskedImageModeling,
										    DataaVecVisionForSemanticSegmentation,
										    DataaVecVisionModel,
										    DataaVecVisionPreTrainedModel,
										)
					if is_tf_available():
										from .modeling_tf_dataavec_vision import (
										    TFDataaVecVisionForImageClassification,
										    TFDataaVecVisionForSemanticSegmentation,
										    TFDataaVecVisionModel,
										    TFDataaVecVisionPreTrainedModel,
										)

else:
					import sys

					SCREAMING_SNAKE_CASE__   =					_LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)


