


"""simple docstring"""

import functools
import operator

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


UpperCAmelCase__  							=logging.get_logger(__name__)

UpperCAmelCase__  							={
    "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__						(		_a    ):
      a :     List[str]											=		"""wavlm"""
      def __init__(		self	:	Dict      ,       A_	:	Any=3_2      ,       A_	:	Dict=7_6_8      ,       A_	:	List[Any]=1_2      ,       A_	:	Any=1_2      ,       A_	:	Optional[Any]=3_0_7_2      ,       A_	:	Dict="gelu"      ,       A_	:	List[Any]=0.1      ,       A_	:	Optional[int]=0.1      ,       A_	:	Optional[Any]=0.1      ,       A_	:	Dict=0.0      ,       A_	:	List[Any]=0.1      ,       A_	:	Optional[int]=0.1      ,       A_	:	Union[str, Any]=0.02      ,       A_	:	Dict=1e-5      ,       A_	:	List[Any]="group"      ,       A_	:	List[Any]="gelu"      ,       A_	:	Union[str, Any]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)      ,       A_	:	str=(5, 2, 2, 2, 2, 2, 2)      ,       A_	:	List[str]=(1_0, 3, 3, 3, 3, 2, 2)      ,       A_	:	Tuple=False      ,       A_	:	Union[str, Any]=1_2_8      ,       A_	:	int=1_6      ,       A_	:	Optional[int]=3_2_0      ,       A_	:	Any=8_0_0      ,       A_	:	Any=False      ,       A_	:	Optional[int]=True      ,       A_	:	int=0.05      ,       A_	:	str=1_0      ,       A_	:	Optional[int]=2      ,       A_	:	List[Any]=0.0      ,       A_	:	Tuple=1_0      ,       A_	:	List[str]=3_2_0      ,       A_	:	Optional[int]=2      ,       A_	:	Dict=0.1      ,       A_	:	Union[str, Any]=1_0_0      ,       A_	:	Any=2_5_6      ,       A_	:	List[str]=2_5_6      ,       A_	:	Any=0.1      ,       A_	:	int="mean"      ,       A_	:	int=False      ,       A_	:	List[Any]=False      ,       A_	:	Dict=2_5_6      ,       A_	:	str=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)      ,       A_	:	List[str]=(5, 3, 3, 1, 1)      ,       A_	:	str=(1, 2, 3, 1, 1)      ,       A_	:	Any=5_1_2      ,       A_	:	Tuple=8_0      ,       A_	:	Optional[int]=0      ,       A_	:	Union[str, Any]=1      ,       A_	:	int=2      ,       A_	:	int=False      ,       A_	:	str=3      ,       A_	:	Tuple=2      ,       A_	:	Optional[Any]=3      ,       A_	:	Optional[Any]=None      ,       **A_	:	Any      ,       ):






       '''simple docstring'''


       super().__init__(**A_      ,       pad_token_id=A_      ,       bos_token_id=A_      ,       eos_token_id=A_							)
       __lowercase									=	hidden_size
       __lowercase									=	feat_extract_norm
       __lowercase									=	feat_extract_activation
       __lowercase									=	list(A_							)
       __lowercase									=	list(A_							)
       __lowercase									=	list(A_							)
       __lowercase									=	conv_bias
       __lowercase									=	num_buckets
       __lowercase									=	max_bucket_distance
       __lowercase									=	num_conv_pos_embeddings
       __lowercase									=	num_conv_pos_embedding_groups
       __lowercase									=	len(self.conv_dim							)
       __lowercase									=	num_hidden_layers
       __lowercase									=	intermediate_size
       __lowercase									=	hidden_act
       __lowercase									=	num_attention_heads
       __lowercase									=	hidden_dropout
       __lowercase									=	attention_dropout
       __lowercase									=	activation_dropout
       __lowercase									=	feat_proj_dropout
       __lowercase									=	final_dropout
       __lowercase									=	layerdrop
       __lowercase									=	layer_norm_eps
       __lowercase									=	initializer_range
       __lowercase									=	num_ctc_classes
       __lowercase									=	vocab_size
       __lowercase									=	do_stable_layer_norm
       __lowercase									=	use_weighted_layer_sum
       __lowercase									=	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
       __lowercase									=	apply_spec_augment
       __lowercase									=	mask_time_prob
       __lowercase									=	mask_time_length
       __lowercase									=	mask_time_min_masks
       __lowercase									=	mask_feature_prob
       __lowercase									=	mask_feature_length

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

       # ctc loss
       __lowercase									=	ctc_loss_reduction
       __lowercase									=	ctc_zero_infinity

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

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

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






      @property
      def SCREAMING_SNAKE_CASE_	(		self	:	Tuple							):






       '''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


UpperCAmelCase__  							={
    "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:
       UpperCAmelCase__  							=[
           "DATA2VEC_AUDIO_PRETRAINED_MODEL_ARCHIVE_LIST",
           "Data2VecAudioForAudioFrameClassification",
           "Data2VecAudioForCTC",
           "Data2VecAudioForSequenceClassification",
           "Data2VecAudioForXVector",
           "Data2VecAudioModel",
           "Data2VecAudioPreTrainedModel",
       ]
       UpperCAmelCase__  							=[
           "DATA2VEC_TEXT_PRETRAINED_MODEL_ARCHIVE_LIST",
           "Data2VecTextForCausalLM",
           "Data2VecTextForMaskedLM",
           "Data2VecTextForMultipleChoice",
           "Data2VecTextForQuestionAnswering",
           "Data2VecTextForSequenceClassification",
           "Data2VecTextForTokenClassification",
           "Data2VecTextModel",
           "Data2VecTextPreTrainedModel",
       ]
       UpperCAmelCase__  							=[
           "DATA2VEC_VISION_PRETRAINED_MODEL_ARCHIVE_LIST",
           "Data2VecVisionForImageClassification",
           "Data2VecVisionForMaskedImageModeling",
           "Data2VecVisionForSemanticSegmentation",
           "Data2VecVisionModel",
           "Data2VecVisionPreTrainedModel",
       ]

if is_tf_available():
       UpperCAmelCase__  							=[
           "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

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