






'''simple docstring'''






import functools
import operator

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


UpperCamelCase__:     str										=    logging.get_logger(__name__)

UpperCamelCase__:     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        SCREAMING_SNAKE_CASE(							UpperCAmelCase_    ):







	"""simple docstring"""






	lowerCamelCase__    				= """wavlm"""







	def __init__(		self    :  Dict	,    __snake_case    :  Union[str, Any]=32	,    __snake_case    :  int=768	,    __snake_case    :  Union[str, Any]=12	,    __snake_case    :  Optional[Any]=12	,    __snake_case    :  str=3072	,    __snake_case    :  Optional[int]="gelu"	,    __snake_case    :  List[str]=0.1	,    __snake_case    :  Any=0.1	,    __snake_case    :  List[Any]=0.1	,    __snake_case    :  int=0.0	,    __snake_case    :  Tuple=0.1	,    __snake_case    :  Optional[Any]=0.1	,    __snake_case    :  Any=0.02	,    __snake_case    :  Optional[int]=1E-5	,    __snake_case    :  List[str]="group"	,    __snake_case    :  List[str]="gelu"	,    __snake_case    :  Any=(512, 512, 512, 512, 512, 512, 512)	,    __snake_case    :  List[Any]=(5, 2, 2, 2, 2, 2, 2)	,    __snake_case    :  Union[str, Any]=(10, 3, 3, 3, 3, 2, 2)	,    __snake_case    :  Any=False	,    __snake_case    :  Optional[Any]=128	,    __snake_case    :  str=16	,    __snake_case    :  str=320	,    __snake_case    :  Optional[Any]=800	,    __snake_case    :  Tuple=False	,    __snake_case    :  Union[str, Any]=True	,    __snake_case    :  int=0.05	,    __snake_case    :  List[Any]=10	,    __snake_case    :  Optional[int]=2	,    __snake_case    :  Union[str, Any]=0.0	,    __snake_case    :  Dict=10	,    __snake_case    :  Optional[Any]=320	,    __snake_case    :  Optional[int]=2	,    __snake_case    :  Any=0.1	,    __snake_case    :  Optional[Any]=100	,    __snake_case    :  Tuple=256	,    __snake_case    :  Dict=256	,    __snake_case    :  Optional[int]=0.1	,    __snake_case    :  List[str]="mean"	,    __snake_case    :  Dict=False	,    __snake_case    :  List[str]=False	,    __snake_case    :  Dict=256	,    __snake_case    :  str=(512, 512, 512, 512, 1500)	,    __snake_case    :  Optional[int]=(5, 3, 3, 1, 1)	,    __snake_case    :  List[Any]=(1, 2, 3, 1, 1)	,    __snake_case    :  Optional[Any]=512	,    __snake_case    :  str=80	,    __snake_case    :  str=0	,    __snake_case    :  Optional[Any]=1	,    __snake_case    :  Tuple=2	,    __snake_case    :  int=False	,    __snake_case    :  int=3	,    __snake_case    :  List[Any]=2	,    __snake_case    :  int=3	,    __snake_case    :  Any=None	,    **__snake_case    :  Optional[int]	,    )    ->	List[str]:
								super().__init__(**_lowercase	,    pad_token_id=_lowercase	,    bos_token_id=_lowercase	,    eos_token_id=_lowercase	)
								UpperCAmelCase				: Dict											=	hidden_size
								UpperCAmelCase				: Optional[int]											=	feat_extract_norm
								UpperCAmelCase				: List[Any]											=	feat_extract_activation
								UpperCAmelCase				: List[str]											=	list(_lowercase	)
								UpperCAmelCase				: Union[str, Any]											=	list(_lowercase	)
								UpperCAmelCase				: Tuple											=	list(_lowercase	)
								UpperCAmelCase				: Tuple											=	conv_bias
								UpperCAmelCase				: List[Any]											=	num_buckets
								UpperCAmelCase				: str											=	max_bucket_distance
								UpperCAmelCase				: List[Any]											=	num_conv_pos_embeddings
								UpperCAmelCase				: List[str]											=	num_conv_pos_embedding_groups
								UpperCAmelCase				: List[str]											=	len(self.conv_dim	)
								UpperCAmelCase				: Tuple											=	num_hidden_layers
								UpperCAmelCase				: List[str]											=	intermediate_size
								UpperCAmelCase				: int											=	hidden_act
								UpperCAmelCase				: Optional[int]											=	num_attention_heads
								UpperCAmelCase				: Tuple											=	hidden_dropout
								UpperCAmelCase				: Dict											=	attention_dropout
								UpperCAmelCase				: Dict											=	activation_dropout
								UpperCAmelCase				: Union[str, Any]											=	feat_proj_dropout
								UpperCAmelCase				: Optional[Any]											=	final_dropout
								UpperCAmelCase				: List[str]											=	layerdrop
								UpperCAmelCase				: str											=	layer_norm_eps
								UpperCAmelCase				: List[str]											=	initializer_range
								UpperCAmelCase				: Tuple											=	num_ctc_classes
								UpperCAmelCase				: Optional[Any]											=	vocab_size
								UpperCAmelCase				: Optional[int]											=	do_stable_layer_norm
								UpperCAmelCase				: Tuple											=	use_weighted_layer_sum
								UpperCAmelCase				: Optional[Any]											=	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				: Tuple											=	apply_spec_augment
								UpperCAmelCase				: List[str]											=	mask_time_prob
								UpperCAmelCase				: Any											=	mask_time_length
								UpperCAmelCase				: int											=	mask_time_min_masks
								UpperCAmelCase				: Optional[Any]											=	mask_feature_prob
								UpperCAmelCase				: Any											=	mask_feature_length

								# parameters for pretraining with codevector quantized representations
								UpperCAmelCase				: Tuple											=	num_codevectors_per_group
								UpperCAmelCase				: Optional[int]											=	num_codevector_groups
								UpperCAmelCase				: Optional[int]											=	contrastive_logits_temperature
								UpperCAmelCase				: Union[str, Any]											=	num_negatives
								UpperCAmelCase				: List[Any]											=	codevector_dim
								UpperCAmelCase				: Union[str, Any]											=	proj_codevector_dim
								UpperCAmelCase				: int											=	diversity_loss_weight

								# ctc loss
								UpperCAmelCase				: Optional[int]											=	ctc_loss_reduction
								UpperCAmelCase				: int											=	ctc_zero_infinity

								# adapter
								UpperCAmelCase				: Dict											=	add_adapter
								UpperCAmelCase				: Optional[int]											=	adapter_kernel_size
								UpperCAmelCase				: List[str]											=	adapter_stride
								UpperCAmelCase				: Union[str, Any]											=	num_adapter_layers
								UpperCAmelCase				: Union[str, Any]											=	output_hidden_size or hidden_size

								# SequenceClassification-specific parameter. Feel free to ignore for other classes.
								UpperCAmelCase				: str											=	classifier_proj_size

								# XVector-specific parameters. Feel free to ignore for other classes.
								UpperCAmelCase				: int											=	list(_lowercase	)
								UpperCAmelCase				: int											=	list(_lowercase	)
								UpperCAmelCase				: List[str]											=	list(_lowercase	)
								UpperCAmelCase				: Union[str, Any]											=	xvector_output_dim







	@property
	def   A			(		self    :  Dict	)    ->	Optional[int]:
								return functools.reduce(operator.mul	,    self.conv_stride	,    1	)










'''simple docstring'''






from dataclasses import dataclass, field
from typing import ClassVar, Dict

from ..features import Features, Value
from .base import TaskTemplate

@dataclass(frozen=A__    )
class        SCREAMING_SNAKE_CASE(							A__    ):







	"""simple docstring"""






	lowerCamelCase__    				= field(default="""language-modeling"""							,	metadata={"""include_in_asdict_even_if_is_default""": True}    )

	lowerCamelCase__    				= Features({"""text""": Value("""string"""    )}    )
	lowerCamelCase__    				= Features({}    )
	lowerCamelCase__    				= "text"







	@property
	def   A			(		self    :  Optional[Any]	)    ->	Dict[str, str]:
								return {self.text_column: "text"}





