import functools
import operator

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


A						=			logging.get_logger(__name__)

A						=			{
    '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     lowerCAmelCase__     (				SCREAMING_SNAKE_CASE_			):


		'''simple docstring'''






		lowerCAmelCase_     =   'wav2vec2'
		def __init__(       self     :     Optional[Any]     ,  snake_case__     :     str=3_2     ,  snake_case__     :     Optional[int]=7_6_8     ,  snake_case__     :     List[Any]=1_2     ,  snake_case__     :     List[Any]=1_2     ,  snake_case__     :     Tuple=3_0_7_2     ,  snake_case__     :     Optional[int]="gelu"     ,  snake_case__     :     List[Any]=0.1     ,  snake_case__     :     Optional[int]=0.1     ,  snake_case__     :     str=0.1     ,  snake_case__     :     Tuple=0.0     ,  snake_case__     :     Any=0.0     ,  snake_case__     :     Dict=0.1     ,  snake_case__     :     int=0.1     ,  snake_case__     :     Dict=0.02     ,  snake_case__     :     Union[str, Any]=1e-5     ,  snake_case__     :     Optional[Any]="group"     ,  snake_case__     :     Optional[int]="gelu"     ,  snake_case__     :     List[Any]=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)     ,  snake_case__     :     Any=(5, 2, 2, 2, 2, 2, 2)     ,  snake_case__     :     Tuple=(1_0, 3, 3, 3, 3, 2, 2)     ,  snake_case__     :     Optional[Any]=False     ,  snake_case__     :     Optional[Any]=1_2_8     ,  snake_case__     :     str=1_6     ,  snake_case__     :     Tuple=False     ,  snake_case__     :     List[Any]=True     ,  snake_case__     :     Any=0.05     ,  snake_case__     :     Optional[int]=1_0     ,  snake_case__     :     int=2     ,  snake_case__     :     Dict=0.0     ,  snake_case__     :     Any=1_0     ,  snake_case__     :     List[Any]=0     ,  snake_case__     :     List[str]=3_2_0     ,  snake_case__     :     Optional[int]=2     ,  snake_case__     :     Optional[Any]=0.1     ,  snake_case__     :     Any=1_0_0     ,  snake_case__     :     Optional[Any]=2_5_6     ,  snake_case__     :     Optional[Any]=2_5_6     ,  snake_case__     :     int=0.1     ,  snake_case__     :     Any="sum"     ,  snake_case__     :     str=False     ,  snake_case__     :     Dict=False     ,  snake_case__     :     Any=2_5_6     ,  snake_case__     :     Tuple=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)     ,  snake_case__     :     Tuple=(5, 3, 3, 1, 1)     ,  snake_case__     :     Tuple=(1, 2, 3, 1, 1)     ,  snake_case__     :     str=5_1_2     ,  snake_case__     :     List[str]=0     ,  snake_case__     :     Optional[int]=1     ,  snake_case__     :     str=2     ,  snake_case__     :     List[str]=False     ,  snake_case__     :     List[Any]=3     ,  snake_case__     :     Union[str, Any]=2     ,  snake_case__     :     Tuple=3     ,  snake_case__     :     Dict=None     ,  snake_case__     :     str=None     ,  **snake_case__     :     Optional[Any]     ,  )      ->	Union[str, Any]:
				super().__init__(**snake_case__     ,  pad_token_id=snake_case__     ,  bos_token_id=snake_case__     ,  eos_token_id=snake_case__		)
				_lowerCamelCase				   =  hidden_size
				_lowerCamelCase				   =  feat_extract_norm
				_lowerCamelCase				   =  feat_extract_activation
				_lowerCamelCase				   =  list(snake_case__		)
				_lowerCamelCase				   =  list(snake_case__		)
				_lowerCamelCase				   =  list(snake_case__		)
				_lowerCamelCase				   =  conv_bias
				_lowerCamelCase				   =  num_conv_pos_embeddings
				_lowerCamelCase				   =  num_conv_pos_embedding_groups
				_lowerCamelCase				   =  len(self.conv_dim		)
				_lowerCamelCase				   =  num_hidden_layers
				_lowerCamelCase				   =  intermediate_size
				_lowerCamelCase				   =  hidden_act
				_lowerCamelCase				   =  num_attention_heads
				_lowerCamelCase				   =  hidden_dropout
				_lowerCamelCase				   =  attention_dropout
				_lowerCamelCase				   =  activation_dropout
				_lowerCamelCase				   =  feat_proj_dropout
				_lowerCamelCase				   =  final_dropout
				_lowerCamelCase				   =  layerdrop
				_lowerCamelCase				   =  layer_norm_eps
				_lowerCamelCase				   =  initializer_range
				_lowerCamelCase				   =  vocab_size
				_lowerCamelCase				   =  do_stable_layer_norm
				_lowerCamelCase				   =  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
				_lowerCamelCase				   =  apply_spec_augment
				_lowerCamelCase				   =  mask_time_prob
				_lowerCamelCase				   =  mask_time_length
				_lowerCamelCase				   =  mask_time_min_masks
				_lowerCamelCase				   =  mask_feature_prob
				_lowerCamelCase				   =  mask_feature_length
				_lowerCamelCase				   =  mask_feature_min_masks

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

				# ctc loss
				_lowerCamelCase				   =  ctc_loss_reduction
				_lowerCamelCase				   =  ctc_zero_infinity

				# adapter
				_lowerCamelCase				   =  add_adapter
				_lowerCamelCase				   =  adapter_kernel_size
				_lowerCamelCase				   =  adapter_stride
				_lowerCamelCase				   =  num_adapter_layers
				_lowerCamelCase				   =  output_hidden_size or hidden_size
				_lowerCamelCase				   =  adapter_attn_dim

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

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



		@property
		def   _snake_case       (       self     :     Optional[int]		)      ->	Any:
				return functools.reduce(operator.mul     ,  self.conv_stride     ,  1		)
from abc import ABC, abstractmethod
from argparse import ArgumentParser





class     lowerCAmelCase__     (				SCREAMING_SNAKE_CASE_			):


		'''simple docstring'''






		@staticmethod
		@abstractmethod
		def   _snake_case       (       snake_case__     :     ArgumentParser		)      ->	Tuple:
				raise NotImplementedError()



		@abstractmethod
		def   _snake_case       (       self     :     Optional[Any]		)      ->	Optional[Any]:
				raise NotImplementedError()