
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 					lowercase__(							UpperCAmelCase				):



	"""simple docstring"""




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

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

					# ctc loss
					lowercase_	    =   ctc_loss_reduction
					lowercase_	    =   ctc_zero_infinity

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

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

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




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











import warnings

from ...utils import logging
from .image_processing_yolos import YolosImageProcessor


_lowercase		:  int			       =logging.get_logger(__name__)






class 						UpperCamelCase_  (  snake_case__							):



					def __init__(		self     :     Tuple       ,      *lowerCamelCase     :     List[Any]       ,      **lowerCamelCase     :     Union[str, Any]						):
							warnings.warn(
							    'The class YolosFeatureExtractor is deprecated and will be removed in version 5 of Transformers. Please'
							    ' use YolosImageProcessor instead.'       ,      lowerCamelCase       ,      )
							super().__init__(*lowerCamelCase       ,      **lowerCamelCase						)
