


"""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 			lowerCamelCase__						(   UpperCAmelCase_			):
						lowerCAmelCase       =     """wavlm"""







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

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

								# ctc loss
								A					       = ctc_loss_reduction
								A					       = ctc_zero_infinity

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

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

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







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









"""simple docstring"""


from typing import TYPE_CHECKING

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


UpperCamelCase						:				Any             =      {
    "configuration_lxmert": ["LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP", "LxmertConfig"],
    "tokenization_lxmert": ["LxmertTokenizer"],
}

try:
	if not is_tokenizers_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	UpperCamelCase						:				int             =      ["LxmertTokenizerFast"]

try:
	if not is_torch_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	UpperCamelCase						:				Union[str, Any]             =      [
	    "LxmertEncoder",
	    "LxmertForPreTraining",
	    "LxmertForQuestionAnswering",
	    "LxmertModel",
	    "LxmertPreTrainedModel",
	    "LxmertVisualFeatureEncoder",
	    "LxmertXLayer",
	]

try:
	if not is_tf_available():
		raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
	pass
else:
	UpperCamelCase						:				Union[str, Any]             =      [
	    "TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST",
	    "TFLxmertForPreTraining",
	    "TFLxmertMainLayer",
	    "TFLxmertModel",
	    "TFLxmertPreTrainedModel",
	    "TFLxmertVisualFeatureEncoder",
	]


if TYPE_CHECKING:
	from .configuration_lxmert import LXMERT_PRETRAINED_CONFIG_ARCHIVE_MAP, LxmertConfig
	from .tokenization_lxmert import LxmertTokenizer

	try:
		if not is_tokenizers_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .tokenization_lxmert_fast import LxmertTokenizerFast

	try:
		if not is_torch_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_lxmert import (
		    LxmertEncoder,
		    LxmertForPreTraining,
		    LxmertForQuestionAnswering,
		    LxmertModel,
		    LxmertPreTrainedModel,
		    LxmertVisualFeatureEncoder,
		    LxmertXLayer,
		)

	try:
		if not is_tf_available():
			raise OptionalDependencyNotAvailable()
	except OptionalDependencyNotAvailable:
		pass
	else:
		from .modeling_tf_lxmert import (
		    TF_LXMERT_PRETRAINED_MODEL_ARCHIVE_LIST,
		    TFLxmertForPreTraining,
		    TFLxmertMainLayer,
		    TFLxmertModel,
		    TFLxmertPreTrainedModel,
		    TFLxmertVisualFeatureEncoder,
		)

else:
	import sys

	UpperCamelCase						:				Dict             =      _LazyModule(__name__, globals()["__file__"], _import_structure, module_spec=__spec__)





