



import functools
import operator

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


_lowercase     							=		logging.get_logger(__name__)

_lowercase     							=		{
    '''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 				__A					( A_      ):
			UpperCamelCase					:Union[str, Any]     =			'''wavlm'''





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

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

						# ctc loss
						lowerCamelCase__ :      List[Any]								=		ctc_loss_reduction
						lowerCamelCase__ :      List[Any]								=		ctc_zero_infinity

						# adapter
						lowerCamelCase__ :      Optional[int]								=		add_adapter
						lowerCamelCase__ :      Optional[int]								=		adapter_kernel_size
						lowerCamelCase__ :      Optional[int]								=		adapter_stride
						lowerCamelCase__ :      Optional[int]								=		num_adapter_layers
						lowerCamelCase__ :      int								=		output_hidden_size or hidden_size

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

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





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








# Author: OMKAR PATHAK, Nwachukwu Chidiebere

# Use a Python dictionary to construct the graph.
from __future__ import annotations

from pprint import pformat
from typing import Generic, TypeVar

_lowercase     							=						TypeVar('''T''')
class 				__A					( Generic[T]      ):





			def __init__(self							,    __magic_name__ = True				):
						lowerCamelCase__ :      dict[T, list[T]]								=		{}  # dictionary of lists
						lowerCamelCase__ :      List[str]								=		directed





			def        _snake_case    (self							,    __magic_name__							,    __magic_name__				):

						if not self.directed:  # For undirected graphs
									# if both source vertex and destination vertex are both present in the
									# adjacency list, add destination vertex to source vertex list of adjacent
									# vertices and add source vertex to destination vertex list of adjacent
									# vertices.
									if source_vertex in self.adj_list and destination_vertex in self.adj_list:
												self.adj_list[source_vertex].append(__magic_name__				)
												self.adj_list[destination_vertex].append(__magic_name__				)
									# if only source vertex is present in adjacency list, add destination vertex
									# to source vertex list of adjacent vertices, then create a new vertex with
									# destination vertex as key and assign a list containing the source vertex
									# as it's first adjacent vertex.
									elif source_vertex in self.adj_list:
												self.adj_list[source_vertex].append(__magic_name__				)
												lowerCamelCase__ :      int								=		[source_vertex]
									# if only destination vertex is present in adjacency list, add source vertex
									# to destination vertex list of adjacent vertices, then create a new vertex
									# with source vertex as key and assign a list containing the source vertex
									# as it's first adjacent vertex.
									elif destination_vertex in self.adj_list:
												self.adj_list[destination_vertex].append(__magic_name__				)
												lowerCamelCase__ :      Dict								=		[destination_vertex]
									# if both source vertex and destination vertex are not present in adjacency
									# list, create a new vertex with source vertex as key and assign a list
									# containing the destination vertex as it's first adjacent vertex also
									# create a new vertex with destination vertex as key and assign a list
									# containing the source vertex as it's first adjacent vertex.
									else:
												lowerCamelCase__ :      Any								=		[destination_vertex]
												lowerCamelCase__ :      Optional[Any]								=		[source_vertex]
						else:  # For directed graphs
									# if both source vertex and destination vertex are present in adjacency
									# list, add destination vertex to source vertex list of adjacent vertices.
									if source_vertex in self.adj_list and destination_vertex in self.adj_list:
												self.adj_list[source_vertex].append(__magic_name__				)
									# if only source vertex is present in adjacency list, add destination
									# vertex to source vertex list of adjacent vertices and create a new vertex
									# with destination vertex as key, which has no adjacent vertex
									elif source_vertex in self.adj_list:
												self.adj_list[source_vertex].append(__magic_name__				)
												lowerCamelCase__ :      Optional[Any]								=		[]
									# if only destination vertex is present in adjacency list, create a new
									# vertex with source vertex as key and assign a list containing destination
									# vertex as first adjacent vertex
									elif destination_vertex in self.adj_list:
												lowerCamelCase__ :      Tuple								=		[destination_vertex]
									# if both source vertex and destination vertex are not present in adjacency
									# list, create a new vertex with source vertex as key and a list containing
									# destination vertex as it's first adjacent vertex. Then create a new vertex
									# with destination vertex as key, which has no adjacent vertex
									else:
												lowerCamelCase__ :      Optional[int]								=		[destination_vertex]
												lowerCamelCase__ :      List[Any]								=		[]

						return self





			def __repr__(self				):
						return pformat(self.adj_list				)



