


import functools
import operator

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


__lowerCAmelCase	: Optional[Any]  				=logging.get_logger(__name__)

__lowerCAmelCase	: List[str]  				={
    'facebook/wav2vec2-base-960h': 'https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/config.json',
    # See all Wav2Vec2 models at https://huggingface.co/models?filter=wav2vec2
}
class        _lowercase      (			A__       ):






				'''simple docstring'''



				SCREAMING_SNAKE_CASE__				:			Any						=		'''wav2vec2'''


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

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

										# ctc loss
										__SCREAMING_SNAKE_CASE						:     Tuple					=		ctc_loss_reduction
										__SCREAMING_SNAKE_CASE						:     Optional[int]					=		ctc_zero_infinity

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

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

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



				@property
				def 		__magic_name__(       self			:List[Any]	)		->			Any:
										return functools.reduce(operator.mul			,			self.conv_stride			,			1	)


from collections import deque





def 			lowerCamelCase_ (				lowerCamelCase__    ):
				lowerCamelCase_						=			len(lowerCamelCase__    )
				lowerCamelCase_						=			deque()
				lowerCamelCase_						=			[False for _ in range(lowerCamelCase__    )]
				lowerCamelCase_						=			[-1 for _ in range(lowerCamelCase__    )]
				lowerCamelCase_						=			index_of[:]

				def strong_connect(lowerCamelCase__	, lowerCamelCase__	, lowerCamelCase__    ):
								lowerCamelCase_						=			index  # the number when this node is seen
								lowerCamelCase_						=			index  # lowest rank node reachable from here
								index += 1
								stack.append(lowerCamelCase__    )
								lowerCamelCase_						=			True

								for w in g[v]:
												if index_of[w] == -1:
																lowerCamelCase_						=			strong_connect(lowerCamelCase__	, lowerCamelCase__	, lowerCamelCase__    )
																lowerCamelCase_						=			(
																    lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
																)
												elif on_stack[w]:
																lowerCamelCase_						=			(
																    lowlink_of[w] if lowlink_of[w] < lowlink_of[v] else lowlink_of[v]
																)

								if lowlink_of[v] == index_of[v]:
												lowerCamelCase_						=			[]
												lowerCamelCase_						=			stack.pop()
												lowerCamelCase_						=			False
												component.append(lowerCamelCase__    )
												while w != v:
																lowerCamelCase_						=			stack.pop()
																lowerCamelCase_						=			False
																component.append(lowerCamelCase__    )
												components.append(lowerCamelCase__    )
								return index

				lowerCamelCase_						=			[]
				for v in range(lowerCamelCase__    ):
								if index_of[v] == -1:
												strong_connect(lowerCamelCase__	, 0	, lowerCamelCase__    )

				return components





def 			lowerCamelCase_ (				lowerCamelCase__	, lowerCamelCase__    ):
				lowerCamelCase_						=			[[] for _ in range(lowerCamelCase__    )]
				for u, v in edges:
								g[u].append(lowerCamelCase__    )
				return g


if __name__ == "__main__":
			# Test
			__A				=7
			__A				=[0, 0, 1, 2, 3, 3, 4, 4, 6]
			__A				=[1, 3, 2, 0, 1, 4, 5, 6, 5]
			__A				=[(u, v) for u, v in zip(source, target)]
			__A				=create_graph(n_vertices, edges)

			assert [[5], [6], [4], [3, 2, 1, 0]] == tarjan(g)


