






import functools
import operator

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


_UpperCamelCase			:	int								=logging.get_logger(__name__)

_UpperCamelCase			:	int								={
    '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__ (							__snake_case							):
		__snake_case      :       Dict     =   "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__       ,):
						super().__init__(**A__       ,pad_token_id=A__       ,bos_token_id=A__       ,eos_token_id=A__		)
						_A	:				List[str]   =      hidden_size
						_A	:				List[str]   =      feat_extract_norm
						_A	:				Tuple   =      feat_extract_activation
						_A	:				Union[str, Any]   =      list(A__		)
						_A	:				Tuple   =      list(A__		)
						_A	:				Optional[int]   =      list(A__		)
						_A	:				List[Any]   =      conv_bias
						_A	:				str   =      num_buckets
						_A	:				List[str]   =      max_bucket_distance
						_A	:				str   =      num_conv_pos_embeddings
						_A	:				str   =      num_conv_pos_embedding_groups
						_A	:				List[str]   =      len(self.conv_dim		)
						_A	:				Union[str, Any]   =      num_hidden_layers
						_A	:				Optional[Any]   =      intermediate_size
						_A	:				int   =      hidden_act
						_A	:				str   =      num_attention_heads
						_A	:				Tuple   =      hidden_dropout
						_A	:				Optional[int]   =      attention_dropout
						_A	:				int   =      activation_dropout
						_A	:				List[Any]   =      feat_proj_dropout
						_A	:				List[Any]   =      final_dropout
						_A	:				List[Any]   =      layerdrop
						_A	:				Dict   =      layer_norm_eps
						_A	:				Optional[Any]   =      initializer_range
						_A	:				Dict   =      num_ctc_classes
						_A	:				Optional[int]   =      vocab_size
						_A	:				int   =      do_stable_layer_norm
						_A	:				int   =      use_weighted_layer_sum
						_A	:				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
						_A	:				Optional[int]   =      apply_spec_augment
						_A	:				List[str]   =      mask_time_prob
						_A	:				Dict   =      mask_time_length
						_A	:				Optional[Any]   =      mask_time_min_masks
						_A	:				Optional[int]   =      mask_feature_prob
						_A	:				List[Any]   =      mask_feature_length

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

						# ctc loss
						_A	:				Optional[Any]   =      ctc_loss_reduction
						_A	:				List[str]   =      ctc_zero_infinity

						# adapter
						_A	:				Tuple   =      add_adapter
						_A	:				Tuple   =      adapter_kernel_size
						_A	:				List[str]   =      adapter_stride
						_A	:				int   =      num_adapter_layers
						_A	:				Union[str, Any]   =      output_hidden_size or hidden_size

						# SequenceClassification-specific parameter. Feel free to ignore for other classes.
						_A	:				Union[str, Any]   =      classifier_proj_size

						# XVector-specific parameters. Feel free to ignore for other classes.
						_A	:				List[str]   =      list(A__		)
						_A	:				Any   =      list(A__		)
						_A	:				Optional[int]   =      list(A__		)
						_A	:				Tuple   =      xvector_output_dim







		@property
		def  A__      (					self		):
						return functools.reduce(operator.mul       ,self.conv_stride       ,1		)











from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


_UpperCamelCase			:	Dict								={
    'configuration_albert': ['ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP', 'AlbertConfig', 'AlbertOnnxConfig'],
}

try:
	if not is_sentencepiece_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_UpperCamelCase			:	List[Any]								=['AlbertTokenizer']

try:
	if not is_tokenizers_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_UpperCamelCase			:	List[Any]								=['AlbertTokenizerFast']

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_UpperCamelCase			:	Optional[int]								=[
	    'ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'AlbertForMaskedLM',
	    'AlbertForMultipleChoice',
	    'AlbertForPreTraining',
	    'AlbertForQuestionAnswering',
	    'AlbertForSequenceClassification',
	    'AlbertForTokenClassification',
	    'AlbertModel',
	    'AlbertPreTrainedModel',
	    'load_tf_weights_in_albert',
	]

try:
	if not is_tf_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_UpperCamelCase			:	List[Any]								=[
	    'TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST',
	    'TFAlbertForMaskedLM',
	    'TFAlbertForMultipleChoice',
	    'TFAlbertForPreTraining',
	    'TFAlbertForQuestionAnswering',
	    'TFAlbertForSequenceClassification',
	    'TFAlbertForTokenClassification',
	    'TFAlbertMainLayer',
	    'TFAlbertModel',
	    'TFAlbertPreTrainedModel',
	]

try:
	if not is_flax_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	_UpperCamelCase			:	Any								=[
	    'FlaxAlbertForMaskedLM',
	    'FlaxAlbertForMultipleChoice',
	    'FlaxAlbertForPreTraining',
	    'FlaxAlbertForQuestionAnswering',
	    'FlaxAlbertForSequenceClassification',
	    'FlaxAlbertForTokenClassification',
	    'FlaxAlbertModel',
	    'FlaxAlbertPreTrainedModel',
	]

if TYPE_CHECKING:
	from .configuration_albert import ALBERT_PRETRAINED_CONFIG_ARCHIVE_MAP, AlbertConfig, AlbertOnnxConfig

	try:
		if not is_sentencepiece_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_albert import AlbertTokenizer

	try:
		if not is_tokenizers_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_albert_fast import AlbertTokenizerFast

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_albert import (
		    ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    AlbertForMaskedLM,
		    AlbertForMultipleChoice,
		    AlbertForPreTraining,
		    AlbertForQuestionAnswering,
		    AlbertForSequenceClassification,
		    AlbertForTokenClassification,
		    AlbertModel,
		    AlbertPreTrainedModel,
		    load_tf_weights_in_albert,
		)

	try:
		if not is_tf_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tf_albert import (
		    TF_ALBERT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TFAlbertForMaskedLM,
		    TFAlbertForMultipleChoice,
		    TFAlbertForPreTraining,
		    TFAlbertForQuestionAnswering,
		    TFAlbertForSequenceClassification,
		    TFAlbertForTokenClassification,
		    TFAlbertMainLayer,
		    TFAlbertModel,
		    TFAlbertPreTrainedModel,
		)

	try:
		if not is_flax_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_flax_albert import (
		    FlaxAlbertForMaskedLM,
		    FlaxAlbertForMultipleChoice,
		    FlaxAlbertForPreTraining,
		    FlaxAlbertForQuestionAnswering,
		    FlaxAlbertForSequenceClassification,
		    FlaxAlbertForTokenClassification,
		    FlaxAlbertModel,
		    FlaxAlbertPreTrainedModel,
		)
else:
	import sys

	_UpperCamelCase			:	str								=_LazyModule(__name__, globals()['__file__'], _import_structure, module_spec=__spec__)



