
"""simple docstring"""





from datasets.utils.patching import _PatchedModuleObj, patch_submodule

from . import _test_patching



def  lowerCamelCase__						(     )				->						List[str]:


					"""simple docstring"""





					import os as original_os
					from os import path as original_path
					from os import rename as original_rename
					from os.path import dirname as original_dirname
					from os.path import join as original_join

					assert _test_patching.os is original_os
					assert _test_patching.path is original_path
					assert _test_patching.join is original_join

					assert _test_patching.renamed_os is original_os
					assert _test_patching.renamed_path is original_path
					assert _test_patching.renamed_join is original_join

					_UpperCamelCase									=    '''__test_patch_submodule_mock__'''
					with patch_submodule(_test_patching,	'''os.path.join''',	__snake_case      ):
										# Every way to access os.path.join must be patched, and the rest must stay untouched

										# check os.path.join
										assert isinstance(_test_patching.os,	_PatchedModuleObj      )
										assert isinstance(_test_patching.os.path,	_PatchedModuleObj      )
										assert _test_patching.os.path.join is mock

										# check path.join
										assert isinstance(_test_patching.path,	_PatchedModuleObj      )
										assert _test_patching.path.join is mock

										# check join
										assert _test_patching.join is mock

										# check that the other attributes are untouched
										assert _test_patching.os.rename is original_rename
										assert _test_patching.path.dirname is original_dirname
										assert _test_patching.os.path.dirname is original_dirname

										# Even renamed modules or objects must be patched

										# check renamed_os.path.join
										assert isinstance(_test_patching.renamed_os,	_PatchedModuleObj      )
										assert isinstance(_test_patching.renamed_os.path,	_PatchedModuleObj      )
										assert _test_patching.renamed_os.path.join is mock

										# check renamed_path.join
										assert isinstance(_test_patching.renamed_path,	_PatchedModuleObj      )
										assert _test_patching.renamed_path.join is mock

										# check renamed_join
										assert _test_patching.renamed_join is mock

										# check that the other attributes are untouched
										assert _test_patching.renamed_os.rename is original_rename
										assert _test_patching.renamed_path.dirname is original_dirname
										assert _test_patching.renamed_os.path.dirname is original_dirname

					# check that everthing is back to normal when the patch is over

					assert _test_patching.os is original_os
					assert _test_patching.path is original_path
					assert _test_patching.join is original_join

					assert _test_patching.renamed_os is original_os
					assert _test_patching.renamed_path is original_path
					assert _test_patching.renamed_join is original_join



def  lowerCamelCase__						(     )				->						List[str]:


					"""simple docstring"""





					assert _test_patching.open is open

					_UpperCamelCase									=    '''__test_patch_submodule_builtin_mock__'''
					# _test_patching has "open" in its globals
					assert _test_patching.open is open
					with patch_submodule(_test_patching,	'''open''',	__snake_case      ):
										assert _test_patching.open is mock

					# check that everthing is back to normal when the patch is over

					assert _test_patching.open is open



def  lowerCamelCase__						(     )				->						Union[str, Any]:


					"""simple docstring"""





					_UpperCamelCase									=    '''__test_patch_submodule_missing_mock__'''
					with patch_submodule(_test_patching,	'''pandas.read_csv''',	__snake_case      ):
										pass



def  lowerCamelCase__						(     )				->						Dict:


					"""simple docstring"""





					_UpperCamelCase									=    '''__test_patch_submodule_missing_builtin_mock__'''
					# _test_patching doesn't have "len" in its globals
					assert getattr(_test_patching,	'''len''',	__snake_case      ) is None
					with patch_submodule(_test_patching,	'''len''',	__snake_case      ):
										assert _test_patching.len is mock
					assert _test_patching.len is len



def  lowerCamelCase__						(     )				->						Tuple:


					"""simple docstring"""





					_UpperCamelCase									=    '''__test_patch_submodule_start_and_stop_mock__'''
					_UpperCamelCase									=    patch_submodule(_test_patching,	'''open''',	__snake_case      )
					assert _test_patching.open is open
					patch.start()
					assert _test_patching.open is mock
					patch.stop()
					assert _test_patching.open is open



def  lowerCamelCase__						(     )				->						Optional[int]:


					"""simple docstring"""





					from os import rename as original_rename
					from os.path import dirname as original_dirname
					from os.path import join as original_join

					_UpperCamelCase									=    '''__test_patch_submodule_successive_join__'''
					_UpperCamelCase									=    '''__test_patch_submodule_successive_dirname__'''
					_UpperCamelCase									=    '''__test_patch_submodule_successive_rename__'''
					assert _test_patching.os.path.join is original_join
					assert _test_patching.os.path.dirname is original_dirname
					assert _test_patching.os.rename is original_rename

					with patch_submodule(_test_patching,	'''os.path.join''',	__snake_case      ):
										with patch_submodule(_test_patching,	'''os.rename''',	__snake_case      ):
															with patch_submodule(_test_patching,	'''os.path.dirname''',	__snake_case      ):
																				assert _test_patching.os.path.join is mock_join
																				assert _test_patching.os.path.dirname is mock_dirname
																				assert _test_patching.os.rename is mock_rename

    # try another order
					with patch_submodule(_test_patching,	'''os.rename''',	__snake_case      ):
										with patch_submodule(_test_patching,	'''os.path.join''',	__snake_case      ):
															with patch_submodule(_test_patching,	'''os.path.dirname''',	__snake_case      ):
																				assert _test_patching.os.path.join is mock_join
																				assert _test_patching.os.path.dirname is mock_dirname
																				assert _test_patching.os.rename is mock_rename

					assert _test_patching.os.path.join is original_join
					assert _test_patching.os.path.dirname is original_dirname
					assert _test_patching.os.rename is original_rename



def  lowerCamelCase__						(     )				->						str:


					"""simple docstring"""





					_UpperCamelCase									=    '''__test_patch_submodule_doesnt_exist_mock__'''
					with patch_submodule(_test_patching,	'''__module_that_doesn_exist__.__attribute_that_doesn_exist__''',	__snake_case      ):
										pass
					with patch_submodule(_test_patching,	'''os.__attribute_that_doesn_exist__''',	__snake_case      ):
										pass








"""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)






