
"""simple docstring"""





import functools
import operator

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


_a								=						logging.get_logger(__name__)

_a								=						{
    """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(       lowerCamelCase      ):
		lowercase__         = 'wavlm'



		def __init__(   self							,						__a=32							,						__a=7_68							,						__a=12							,						__a=12							,						__a=30_72							,						__a="gelu"							,						__a=0.1							,						__a=0.1							,						__a=0.1							,						__a=0.0							,						__a=0.1							,						__a=0.1							,						__a=0.02							,						__a=1e-5							,						__a="group"							,						__a="gelu"							,						__a=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)							,						__a=(5, 2, 2, 2, 2, 2, 2)							,						__a=(10, 3, 3, 3, 3, 2, 2)							,						__a=False							,						__a=1_28							,						__a=16							,						__a=3_20							,						__a=8_00							,						__a=False							,						__a=True							,						__a=0.05							,						__a=10							,						__a=2							,						__a=0.0							,						__a=10							,						__a=3_20							,						__a=2							,						__a=0.1							,						__a=1_00							,						__a=2_56							,						__a=2_56							,						__a=0.1							,						__a="mean"							,						__a=False							,						__a=False							,						__a=2_56							,						__a=(5_12, 5_12, 5_12, 5_12, 15_00)							,						__a=(5, 3, 3, 1, 1)							,						__a=(1, 2, 3, 1, 1)							,						__a=5_12							,						__a=80							,						__a=0							,						__a=1							,						__a=2							,						__a=False							,						__a=3							,						__a=2							,						__a=3							,						__a=None							,						**__a							,						)			->			Union[str, Any]:






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

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

							# ctc loss
							_UpperCamelCase									=    ctc_loss_reduction
							_UpperCamelCase									=    ctc_zero_infinity

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

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

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




		@property
		def 		UpperCAmelCase				(   self)			->			Optional[Any]:






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














from pathlib import PurePosixPath
from typing import Optional

import fsspec
from fsspec import AbstractFileSystem
from huggingface_hub.hf_api import DatasetInfo

from ..utils.file_utils import get_authentication_headers_for_url
from ..utils.hub import hf_hub_url
class     lowerCamelCase_					(   lowerCamelCase			):
				a__       							=	''''''
				a__       							=	'''hf-legacy'''  # "hf://"" is reserved for hffs







				def __init__(    self							,       __lowerCAmelCase = None							,       __lowerCAmelCase = None							,       **__lowerCAmelCase							,       ):
								"""simple docstring"""
								super().__init__(self							,       **__lowerCAmelCase  )
								__magic_name__		:List[Any]   =   repo_info
								__magic_name__		:Dict   =   token
								__magic_name__		:Optional[Any]   =   None







				def       A						(    self  ):
								"""simple docstring"""
								if self.dir_cache is None:
												__magic_name__		:Any   =   {}
												for hf_file in self.repo_info.siblings:
																# TODO(QL): add sizes
																__magic_name__		:Optional[int]   =   {
																    '''name''': hf_file.rfilename,
																    '''size''': None,
																    '''type''': '''file''',
																}
																self.dir_cache.update(
																    {
																        str(__lowerCAmelCase  ): {'''name''': str(__lowerCAmelCase  ), '''size''': None, '''type''': '''directory'''}
																        for d in list(PurePosixPath(hf_file.rfilename  ).parents  )[:-1]
																    }  )







				def       A						(    self							,       __lowerCAmelCase							,       __lowerCAmelCase = "rb"							,       **__lowerCAmelCase							,       ):
								"""simple docstring"""
								if not isinstance(self.repo_info							,       __lowerCAmelCase  ):
												raise NotImplementedError(F'''Open is only implemented for dataset repositories, but got {self.repo_info}'''  )
								__magic_name__		:Union[str, Any]   =   hf_hub_url(self.repo_info.id							,       __lowerCAmelCase							,       revision=self.repo_info.sha  )
								return fsspec.open(
								    __lowerCAmelCase							,       mode=__lowerCAmelCase							,       headers=get_authentication_headers_for_url(__lowerCAmelCase							,       use_auth_token=self.token  )							,       client_kwargs={'''trust_env''': True}							,       ).open()







				def       A						(    self							,       __lowerCAmelCase							,       **__lowerCAmelCase  ):
								"""simple docstring"""
								self._get_dirs()
								__magic_name__		:str   =   self._strip_protocol(__lowerCAmelCase  )
								if path in self.dir_cache:
												return self.dir_cache[path]
								else:
												raise FileNotFoundError(__lowerCAmelCase  )







				def       A						(    self							,       __lowerCAmelCase							,       __lowerCAmelCase=False							,       **__lowerCAmelCase  ):
								"""simple docstring"""
								self._get_dirs()
								__magic_name__		:Union[str, Any]   =   PurePosixPath(path.strip('''/'''  )  )
								__magic_name__		:Dict   =   {}
								for p, f in self.dir_cache.items():
												__magic_name__		:int   =   PurePosixPath(p.strip('''/'''  )  )
												__magic_name__		:Tuple   =   p.parent
												if root == path:
																__magic_name__		:Optional[Any]   =   f
								__magic_name__		:List[Any]   =   list(paths.values()  )
								if detail:
												return out
								else:
												return sorted(f['''name'''] for f in out  )






