
import functools
import operator

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


lowerCamelCase_						     =					logging.get_logger(__name__)

lowerCamelCase_						     =					{
    '''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      __A(    __lowerCamelCase			):

		"""simple docstring"""
		SCREAMING_SNAKE_CASE__         =      """wav2vec2"""







		def __init__(self	,      SCREAMING_SNAKE_CASE_=32	,      SCREAMING_SNAKE_CASE_=7_68	,      SCREAMING_SNAKE_CASE_=12	,      SCREAMING_SNAKE_CASE_=12	,      SCREAMING_SNAKE_CASE_=30_72	,      SCREAMING_SNAKE_CASE_="gelu"	,      SCREAMING_SNAKE_CASE_=0.1	,      SCREAMING_SNAKE_CASE_=0.1	,      SCREAMING_SNAKE_CASE_=0.1	,      SCREAMING_SNAKE_CASE_=0.0	,      SCREAMING_SNAKE_CASE_=0.0	,      SCREAMING_SNAKE_CASE_=0.1	,      SCREAMING_SNAKE_CASE_=0.1	,      SCREAMING_SNAKE_CASE_=0.02	,      SCREAMING_SNAKE_CASE_=1E-5	,      SCREAMING_SNAKE_CASE_="group"	,      SCREAMING_SNAKE_CASE_="gelu"	,      SCREAMING_SNAKE_CASE_=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)	,      SCREAMING_SNAKE_CASE_=(5, 2, 2, 2, 2, 2, 2)	,      SCREAMING_SNAKE_CASE_=(10, 3, 3, 3, 3, 2, 2)	,      SCREAMING_SNAKE_CASE_=False	,      SCREAMING_SNAKE_CASE_=1_28	,      SCREAMING_SNAKE_CASE_=16	,      SCREAMING_SNAKE_CASE_=False	,      SCREAMING_SNAKE_CASE_=True	,      SCREAMING_SNAKE_CASE_=0.05	,      SCREAMING_SNAKE_CASE_=10	,      SCREAMING_SNAKE_CASE_=2	,      SCREAMING_SNAKE_CASE_=0.0	,      SCREAMING_SNAKE_CASE_=10	,      SCREAMING_SNAKE_CASE_=0	,      SCREAMING_SNAKE_CASE_=3_20	,      SCREAMING_SNAKE_CASE_=2	,      SCREAMING_SNAKE_CASE_=0.1	,      SCREAMING_SNAKE_CASE_=1_00	,      SCREAMING_SNAKE_CASE_=2_56	,      SCREAMING_SNAKE_CASE_=2_56	,      SCREAMING_SNAKE_CASE_=0.1	,      SCREAMING_SNAKE_CASE_="sum"	,      SCREAMING_SNAKE_CASE_=False	,      SCREAMING_SNAKE_CASE_=False	,      SCREAMING_SNAKE_CASE_=2_56	,      SCREAMING_SNAKE_CASE_=(5_12, 5_12, 5_12, 5_12, 15_00)	,      SCREAMING_SNAKE_CASE_=(5, 3, 3, 1, 1)	,      SCREAMING_SNAKE_CASE_=(1, 2, 3, 1, 1)	,      SCREAMING_SNAKE_CASE_=5_12	,      SCREAMING_SNAKE_CASE_=0	,      SCREAMING_SNAKE_CASE_=1	,      SCREAMING_SNAKE_CASE_=2	,      SCREAMING_SNAKE_CASE_=False	,      SCREAMING_SNAKE_CASE_=3	,      SCREAMING_SNAKE_CASE_=2	,      SCREAMING_SNAKE_CASE_=3	,      SCREAMING_SNAKE_CASE_=None	,      SCREAMING_SNAKE_CASE_=None	,      **SCREAMING_SNAKE_CASE_	,      ):
							super().__init__(**SCREAMING_SNAKE_CASE_	,      pad_token_id=SCREAMING_SNAKE_CASE_	,      bos_token_id=SCREAMING_SNAKE_CASE_	,      eos_token_id=SCREAMING_SNAKE_CASE_						)
							UpperCamelCase__				=    hidden_size
							UpperCamelCase__				=    feat_extract_norm
							UpperCamelCase__				=    feat_extract_activation
							UpperCamelCase__				=    list(SCREAMING_SNAKE_CASE_						)
							UpperCamelCase__				=    list(SCREAMING_SNAKE_CASE_						)
							UpperCamelCase__				=    list(SCREAMING_SNAKE_CASE_						)
							UpperCamelCase__				=    conv_bias
							UpperCamelCase__				=    num_conv_pos_embeddings
							UpperCamelCase__				=    num_conv_pos_embedding_groups
							UpperCamelCase__				=    len(self.conv_dim						)
							UpperCamelCase__				=    num_hidden_layers
							UpperCamelCase__				=    intermediate_size
							UpperCamelCase__				=    hidden_act
							UpperCamelCase__				=    num_attention_heads
							UpperCamelCase__				=    hidden_dropout
							UpperCamelCase__				=    attention_dropout
							UpperCamelCase__				=    activation_dropout
							UpperCamelCase__				=    feat_proj_dropout
							UpperCamelCase__				=    final_dropout
							UpperCamelCase__				=    layerdrop
							UpperCamelCase__				=    layer_norm_eps
							UpperCamelCase__				=    initializer_range
							UpperCamelCase__				=    vocab_size
							UpperCamelCase__				=    do_stable_layer_norm
							UpperCamelCase__				=    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__				=    apply_spec_augment
							UpperCamelCase__				=    mask_time_prob
							UpperCamelCase__				=    mask_time_length
							UpperCamelCase__				=    mask_time_min_masks
							UpperCamelCase__				=    mask_feature_prob
							UpperCamelCase__				=    mask_feature_length
							UpperCamelCase__				=    mask_feature_min_masks

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

							# ctc loss
							UpperCamelCase__				=    ctc_loss_reduction
							UpperCamelCase__				=    ctc_zero_infinity

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

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

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







		@property
		def 	UpperCAmelCase_ (self						):
							return functools.reduce(operator.mul	,      self.conv_stride	,      1						)







from typing import TYPE_CHECKING

from ...utils import _LazyModule


lowerCamelCase_						     =					{'''processing_wav2vec2_with_lm''': ['''Wav2Vec2ProcessorWithLM''']}


if TYPE_CHECKING:
    from .processing_wavaveca_with_lm import WavaVecaProcessorWithLM
else:
    import sys

    lowerCamelCase_						     =					_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





