import functools
import operator

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


snake_case__				= logging.get_logger(__name__)

snake_case__				= {
    '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  UpperCamelCase				( lowercase__ ):

     '''simple docstring'''

     A_										=  'wav2vec2'



     def __init__(					self				,				A_=32				,				A_=7_68				,				A_=12				,				A_=12				,				A_=30_72				,				A_="gelu"				,				A_=0.1				,				A_=0.1				,				A_=0.1				,				A_=0.0				,				A_=0.0				,				A_=0.1				,				A_=0.1				,				A_=0.02				,				A_=1E-5				,				A_="group"				,				A_="gelu"				,				A_=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)				,				A_=(5, 2, 2, 2, 2, 2, 2)				,				A_=(10, 3, 3, 3, 3, 2, 2)				,				A_=False				,				A_=1_28				,				A_=16				,				A_=False				,				A_=True				,				A_=0.05				,				A_=10				,				A_=2				,				A_=0.0				,				A_=10				,				A_=0				,				A_=3_20				,				A_=2				,				A_=0.1				,				A_=1_00				,				A_=2_56				,				A_=2_56				,				A_=0.1				,				A_="sum"				,				A_=False				,				A_=False				,				A_=2_56				,				A_=(5_12, 5_12, 5_12, 5_12, 15_00)				,				A_=(5, 3, 3, 1, 1)				,				A_=(1, 2, 3, 1, 1)				,				A_=5_12				,				A_=0				,				A_=1				,				A_=2				,				A_=False				,				A_=3				,				A_=2				,				A_=3				,				A_=None				,				A_=None				,				**A_				,				) ->				Union[str, Any]:






           """simple docstring"""
           super().__init__(**UpperCAmelCase__				,				pad_token_id=UpperCAmelCase__				,				bos_token_id=UpperCAmelCase__				,				eos_token_id=UpperCAmelCase__						)
           _lowerCamelCase			    =				hidden_size
           _lowerCamelCase			    =				feat_extract_norm
           _lowerCamelCase			    =				feat_extract_activation
           _lowerCamelCase			    =				list(UpperCAmelCase__						)
           _lowerCamelCase			    =				list(UpperCAmelCase__						)
           _lowerCamelCase			    =				list(UpperCAmelCase__						)
           _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(UpperCAmelCase__						)
           _lowerCamelCase			    =				list(UpperCAmelCase__						)
           _lowerCamelCase			    =				list(UpperCAmelCase__						)
           _lowerCamelCase			    =				xvector_output_dim





     @property
     def 		UpperCamelCase_						(					self						) ->				str:






           """simple docstring"""
           return functools.reduce(operator.mul				,				self.conv_stride				,				1						)
from .testing import (
    are_the_same_tensors,
    execute_subprocess_async,
    require_bnb,
    require_cpu,
    require_cuda,
    require_huggingface_suite,
    require_mps,
    require_multi_gpu,
    require_multi_xpu,
    require_safetensors,
    require_single_gpu,
    require_single_xpu,
    require_torch_min_version,
    require_tpu,
    require_xpu,
    skip,
    slow,
)
from .training import RegressionDataset, RegressionModel, RegressionModelaXPU


from .scripts import test_script, test_sync, test_ops  # isort: skip