



'''simple docstring'''






import functools
import operator

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


UpperCamelCase__:   str								=			logging.get_logger(__name__)

UpperCamelCase__:   Tuple								=			{
    "microsoft/unispeech-sat-base-100h-libri-ft": (
        "https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolve/main/config.json"
    ),
    # See all UniSpeechSat models at https://huggingface.co/models?filter=unispeech_sat
}

class 				SCREAMING_SNAKE_CASE(							A__			):







	"""simple docstring"""






	lowerCamelCase__			 =       """unispeech-sat"""







	def __init__(						self			:     str		,			__snake_case			:     List[str]=32		,			__snake_case			:     List[str]=768		,			__snake_case			:     str=12		,			__snake_case			:     int=12		,			__snake_case			:     Union[str, Any]=3072		,			__snake_case			:     List[Any]="gelu"		,			__snake_case			:     Union[str, Any]=0.1		,			__snake_case			:     Union[str, Any]=0.1		,			__snake_case			:     Dict=0.1		,			__snake_case			:     List[Any]=0.0		,			__snake_case			:     Any=0.0		,			__snake_case			:     Any=0.1		,			__snake_case			:     List[str]=0.1		,			__snake_case			:     Optional[Any]=0.02		,			__snake_case			:     Dict=1E-5		,			__snake_case			:     int="group"		,			__snake_case			:     Any="gelu"		,			__snake_case			:     Dict=(512, 512, 512, 512, 512, 512, 512)		,			__snake_case			:     str=(5, 2, 2, 2, 2, 2, 2)		,			__snake_case			:     Tuple=(10, 3, 3, 3, 3, 2, 2)		,			__snake_case			:     Optional[int]=False		,			__snake_case			:     List[str]=128		,			__snake_case			:     Any=16		,			__snake_case			:     List[str]=False		,			__snake_case			:     List[str]=True		,			__snake_case			:     Union[str, Any]=0.05		,			__snake_case			:     Tuple=10		,			__snake_case			:     Optional[Any]=2		,			__snake_case			:     Dict=0.0		,			__snake_case			:     int=10		,			__snake_case			:     Tuple=0		,			__snake_case			:     Dict=320		,			__snake_case			:     List[Any]=2		,			__snake_case			:     int=0.1		,			__snake_case			:     str=100		,			__snake_case			:     List[Any]=256		,			__snake_case			:     str=256		,			__snake_case			:     Tuple=0.1		,			__snake_case			:     int="mean"		,			__snake_case			:     List[str]=False		,			__snake_case			:     Optional[Any]=False		,			__snake_case			:     str=256		,			__snake_case			:     Tuple=(512, 512, 512, 512, 1500)		,			__snake_case			:     Union[str, Any]=(5, 3, 3, 1, 1)		,			__snake_case			:     Dict=(1, 2, 3, 1, 1)		,			__snake_case			:     int=512		,			__snake_case			:     Dict=0		,			__snake_case			:     Optional[int]=1		,			__snake_case			:     int=2		,			__snake_case			:     List[Any]=504		,			**__snake_case			:     Dict		,			)			->		Optional[int]:
								super().__init__(**__snake_case		,			pad_token_id=__snake_case		,			bos_token_id=__snake_case		,			eos_token_id=__snake_case		)
								UpperCAmelCase :       Tuple 							=		hidden_size
								UpperCAmelCase :       Optional[Any] 							=		feat_extract_norm
								UpperCAmelCase :       int 							=		feat_extract_activation
								UpperCAmelCase :       Optional[int] 							=		list(__snake_case		)
								UpperCAmelCase :       List[str] 							=		list(__snake_case		)
								UpperCAmelCase :       List[str] 							=		list(__snake_case		)
								UpperCAmelCase :       Tuple 							=		conv_bias
								UpperCAmelCase :       Union[str, Any] 							=		num_conv_pos_embeddings
								UpperCAmelCase :       Optional[Any] 							=		num_conv_pos_embedding_groups
								UpperCAmelCase :       Tuple 							=		len(self.conv_dim		)
								UpperCAmelCase :       Optional[Any] 							=		num_hidden_layers
								UpperCAmelCase :       Optional[Any] 							=		intermediate_size
								UpperCAmelCase :       Tuple 							=		hidden_act
								UpperCAmelCase :       Union[str, Any] 							=		num_attention_heads
								UpperCAmelCase :       Dict 							=		hidden_dropout
								UpperCAmelCase :       Optional[Any] 							=		attention_dropout
								UpperCAmelCase :       Optional[int] 							=		activation_dropout
								UpperCAmelCase :       Any 							=		feat_proj_dropout
								UpperCAmelCase :       Optional[Any] 							=		final_dropout
								UpperCAmelCase :       int 							=		layerdrop
								UpperCAmelCase :       str 							=		layer_norm_eps
								UpperCAmelCase :       Dict 							=		initializer_range
								UpperCAmelCase :       Any 							=		vocab_size
								UpperCAmelCase :       str 							=		num_clusters
								UpperCAmelCase :       Tuple 							=		do_stable_layer_norm
								UpperCAmelCase :       Any 							=		use_weighted_layer_sum

								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 :       Dict 							=		apply_spec_augment
								UpperCAmelCase :       Optional[int] 							=		mask_time_prob
								UpperCAmelCase :       Union[str, Any] 							=		mask_time_length
								UpperCAmelCase :       Tuple 							=		mask_time_min_masks
								UpperCAmelCase :       Tuple 							=		mask_feature_prob
								UpperCAmelCase :       Optional[Any] 							=		mask_feature_length
								UpperCAmelCase :       List[str] 							=		mask_feature_min_masks

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

								# ctc loss
								UpperCAmelCase :       Tuple 							=		ctc_loss_reduction
								UpperCAmelCase :       List[Any] 							=		ctc_zero_infinity

								# 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 :       Tuple 							=		list(__snake_case		)
								UpperCAmelCase :       List[str] 							=		list(__snake_case		)
								UpperCAmelCase :       List[Any] 							=		list(__snake_case		)
								UpperCAmelCase :       Optional[Any] 							=		xvector_output_dim







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













"""simple docstring"""



# 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

_UpperCamelCase		:  Optional[Any]						=		TypeVar('T')

class        a     (   Generic[T]	):







    def __init__(			self							,		_lowerCamelCase = True       ):
      lowercase							    =       {}  # dictionary of lists
      lowercase							    =       directed







    def 			UpperCamelCase_      (			self							,		_lowerCamelCase							,		_lowerCamelCase       ):

      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(_lowerCamelCase       )
          self.adj_list[destination_vertex].append(_lowerCamelCase       )
        # 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(_lowerCamelCase       )
          lowercase							    =       [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(_lowerCamelCase       )
          lowercase							    =       [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:
          lowercase							    =       [destination_vertex]
          lowercase							    =       [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(_lowerCamelCase       )
        # 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(_lowerCamelCase       )
          lowercase							    =       []
        # 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:
          lowercase							    =       [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:
          lowercase							    =       [destination_vertex]
          lowercase							    =       []

      return self







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


