



import os
from distutils.util import strtobool







def     UpperCAmelCase_		(					snake_case__    ,			snake_case__					)	->     int:



				"""simple docstring"""





				for e in env_keys:
								lowerCAmelCase__		  =  int(os.environ.get(snake_case__    ,			-1					)					)
								if val >= 0:
												return val
				return default







def     UpperCAmelCase_		(					snake_case__    ,			snake_case__=False					)	->     Optional[Any]:



				"""simple docstring"""





				lowerCAmelCase__		  =  os.environ.get(snake_case__    ,			str(snake_case__					)					)
				return strtobool(snake_case__					) == 1  # As its name indicates `strtobool` actually returns an int...







def     UpperCAmelCase_		(					snake_case__    ,			snake_case__="no"					)	->     int:



				"""simple docstring"""





				lowerCAmelCase__		  =  os.environ.get(snake_case__    ,			str(snake_case__					)					)
				return value





import functools
import operator

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


_lowerCAmelCase	:   List[str]    =   logging.get_logger(__name__)

_lowerCAmelCase	:   Tuple    =   {
    "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 	__snake_case   ( SCREAMING_SNAKE_CASE ):
		SCREAMING_SNAKE_CASE__								=	'wavlm'
		def __init__(							self    ,a_=32    ,a_=768    ,a_=12    ,a_=12    ,a_=3072    ,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_=(512, 512, 512, 512, 512, 512, 512)    ,a_=(5, 2, 2, 2, 2, 2, 2)    ,a_=(10, 3, 3, 3, 3, 2, 2)    ,a_=False    ,a_=128    ,a_=16    ,a_=320    ,a_=800    ,a_=False    ,a_=True    ,a_=0.05    ,a_=10    ,a_=2    ,a_=0.0    ,a_=10    ,a_=320    ,a_=2    ,a_=0.1    ,a_=100    ,a_=256    ,a_=256    ,a_=0.1    ,a_="mean"    ,a_=False    ,a_=False    ,a_=256    ,a_=(512, 512, 512, 512, 1500)    ,a_=(5, 3, 3, 1, 1)    ,a_=(1, 2, 3, 1, 1)    ,a_=512    ,a_=80    ,a_=0    ,a_=1    ,a_=2    ,a_=False    ,a_=3    ,a_=2    ,a_=3    ,a_=None    ,**a_    ,):







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

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

						# ctc loss
						lowerCAmelCase__		  =  ctc_loss_reduction
						lowerCAmelCase__		  =  ctc_zero_infinity

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

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

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



		@property
		def 						SCREAMING_SNAKE_CASE_					(							self						):







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