



import functools
import operator

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


A_		:     str        =     logging.get_logger(__name__)

A_		:     Union[str, 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		(       UpperCAmelCase__	):
   _UpperCAmelCase     	=			'''wavlm'''

   def __init__(      self			:       Tuple							,   __lowerCAmelCase			:       Optional[int]=32							,   __lowerCAmelCase			:       Dict=768							,   __lowerCAmelCase			:       int=12							,   __lowerCAmelCase			:       Optional[Any]=12							,   __lowerCAmelCase			:       List[str]=3072							,   __lowerCAmelCase			:       Tuple="gelu"							,   __lowerCAmelCase			:       str=0.1							,   __lowerCAmelCase			:       List[Any]=0.1							,   __lowerCAmelCase			:       str=0.1							,   __lowerCAmelCase			:       int=0.0							,   __lowerCAmelCase			:       Any=0.1							,   __lowerCAmelCase			:       Optional[Any]=0.1							,   __lowerCAmelCase			:       Dict=0.0_2							,   __lowerCAmelCase			:       Tuple=1E-5							,   __lowerCAmelCase			:       Optional[int]="group"							,   __lowerCAmelCase			:       List[Any]="gelu"							,   __lowerCAmelCase			:       List[Any]=(512, 512, 512, 512, 512, 512, 512)							,   __lowerCAmelCase			:       List[Any]=(5, 2, 2, 2, 2, 2, 2)							,   __lowerCAmelCase			:       Dict=(10, 3, 3, 3, 3, 2, 2)							,   __lowerCAmelCase			:       Union[str, Any]=False							,   __lowerCAmelCase			:       int=128							,   __lowerCAmelCase			:       Tuple=16							,   __lowerCAmelCase			:       str=320							,   __lowerCAmelCase			:       List[str]=800							,   __lowerCAmelCase			:       Dict=False							,   __lowerCAmelCase			:       int=True							,   __lowerCAmelCase			:       Union[str, Any]=0.0_5							,   __lowerCAmelCase			:       int=10							,   __lowerCAmelCase			:       Optional[Any]=2							,   __lowerCAmelCase			:       Union[str, Any]=0.0							,   __lowerCAmelCase			:       Optional[int]=10							,   __lowerCAmelCase			:       Dict=320							,   __lowerCAmelCase			:       Dict=2							,   __lowerCAmelCase			:       Any=0.1							,   __lowerCAmelCase			:       Union[str, Any]=100							,   __lowerCAmelCase			:       str=256							,   __lowerCAmelCase			:       int=256							,   __lowerCAmelCase			:       Optional[Any]=0.1							,   __lowerCAmelCase			:       Tuple="mean"							,   __lowerCAmelCase			:       Dict=False							,   __lowerCAmelCase			:       str=False							,   __lowerCAmelCase			:       Union[str, Any]=256							,   __lowerCAmelCase			:       Tuple=(512, 512, 512, 512, 1500)							,   __lowerCAmelCase			:       List[str]=(5, 3, 3, 1, 1)							,   __lowerCAmelCase			:       Tuple=(1, 2, 3, 1, 1)							,   __lowerCAmelCase			:       Optional[int]=512							,   __lowerCAmelCase			:       Any=80							,   __lowerCAmelCase			:       int=0							,   __lowerCAmelCase			:       Dict=1							,   __lowerCAmelCase			:       List[str]=2							,   __lowerCAmelCase			:       Tuple=False							,   __lowerCAmelCase			:       List[Any]=3							,   __lowerCAmelCase			:       Optional[int]=2							,   __lowerCAmelCase			:       Optional[Any]=3							,   __lowerCAmelCase			:       Optional[Any]=None							,   **__lowerCAmelCase			:       List[str]							,   )       ->				int:


    """simple docstring"""






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

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

    # ctc loss
    a						=		ctc_loss_reduction
    a						=		ctc_zero_infinity

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

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

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




   @property
   def 		A							(      self			:       Any							)       ->				Union[str, Any]:


    """simple docstring"""






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






from ...utils import (
    OptionalDependencyNotAvailable,
    is_torch_available,
    is_transformers_available,
    is_transformers_version,
)


try:
     if not (is_transformers_available() and is_torch_available() and is_transformers_version('''>=''', '''4.25.0''')):
          raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
     from ...utils.dummy_torch_and_transformers_objects import UnCLIPImageVariationPipeline, UnCLIPPipeline
else:
     from .pipeline_unclip import UnCLIPPipeline
     from .pipeline_unclip_image_variation import UnCLIPImageVariationPipeline
     from .text_proj import UnCLIPTextProjModel

