
"""simple docstring"""



import functools
import operator

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


a					:	str							=		logging.get_logger(__name__)

a					:	int							=		{
    '''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'''





    a      :				Dict     =				'''wav2vec2'''







    def __init__(			self			:       Union[str, Any]     ,					__UpperCamelCase			:       Optional[int]=32     ,					__UpperCamelCase			:       Optional[Any]=7_68     ,					__UpperCamelCase			:       List[Any]=12     ,					__UpperCamelCase			:       Union[str, Any]=12     ,					__UpperCamelCase			:       Optional[int]=30_72     ,					__UpperCamelCase			:       Any="gelu"     ,					__UpperCamelCase			:       Dict=0.1     ,					__UpperCamelCase			:       Any=0.1     ,					__UpperCamelCase			:       Tuple=0.1     ,					__UpperCamelCase			:       Tuple=0.0     ,					__UpperCamelCase			:       Optional[int]=0.0     ,					__UpperCamelCase			:       Dict=0.1     ,					__UpperCamelCase			:       List[str]=0.1     ,					__UpperCamelCase			:       int=0.0_2     ,					__UpperCamelCase			:       Tuple=1e-5     ,					__UpperCamelCase			:       Optional[int]="group"     ,					__UpperCamelCase			:       Optional[Any]="gelu"     ,					__UpperCamelCase			:       int=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)     ,					__UpperCamelCase			:       List[str]=(5, 2, 2, 2, 2, 2, 2)     ,					__UpperCamelCase			:       str=(10, 3, 3, 3, 3, 2, 2)     ,					__UpperCamelCase			:       int=False     ,					__UpperCamelCase			:       List[str]=1_28     ,					__UpperCamelCase			:       List[Any]=16     ,					__UpperCamelCase			:       Any=False     ,					__UpperCamelCase			:       Optional[Any]=True     ,					__UpperCamelCase			:       int=0.0_5     ,					__UpperCamelCase			:       Optional[Any]=10     ,					__UpperCamelCase			:       Union[str, Any]=2     ,					__UpperCamelCase			:       Optional[int]=0.0     ,					__UpperCamelCase			:       List[str]=10     ,					__UpperCamelCase			:       int=0     ,					__UpperCamelCase			:       Dict=3_20     ,					__UpperCamelCase			:       List[Any]=2     ,					__UpperCamelCase			:       Optional[Any]=0.1     ,					__UpperCamelCase			:       Union[str, Any]=1_00     ,					__UpperCamelCase			:       Tuple=2_56     ,					__UpperCamelCase			:       str=2_56     ,					__UpperCamelCase			:       Optional[int]=0.1     ,					__UpperCamelCase			:       Tuple="sum"     ,					__UpperCamelCase			:       Tuple=False     ,					__UpperCamelCase			:       Optional[Any]=False     ,					__UpperCamelCase			:       Optional[int]=2_56     ,					__UpperCamelCase			:       Optional[Any]=(5_12, 5_12, 5_12, 5_12, 15_00)     ,					__UpperCamelCase			:       List[Any]=(5, 3, 3, 1, 1)     ,					__UpperCamelCase			:       str=(1, 2, 3, 1, 1)     ,					__UpperCamelCase			:       List[Any]=5_12     ,					__UpperCamelCase			:       str=0     ,					__UpperCamelCase			:       int=1     ,					__UpperCamelCase			:       Any=2     ,					__UpperCamelCase			:       List[Any]=False     ,					__UpperCamelCase			:       Union[str, Any]=3     ,					__UpperCamelCase			:       str=2     ,					__UpperCamelCase			:       int=3     ,					__UpperCamelCase			:       Optional[Any]=None     ,					__UpperCamelCase			:       Tuple=None     ,					**__UpperCamelCase			:       List[str]     ,					)		->Optional[Any]:






        '''simple docstring'''






        super().__init__(**lowerCAmelCase_     ,					pad_token_id=lowerCAmelCase_     ,					bos_token_id=lowerCAmelCase_     ,					eos_token_id=lowerCAmelCase_     )
        _UpperCAmelCase          =   hidden_size
        _UpperCAmelCase          =   feat_extract_norm
        _UpperCAmelCase          =   feat_extract_activation
        _UpperCAmelCase          =   list(lowerCAmelCase_     )
        _UpperCAmelCase          =   list(lowerCAmelCase_     )
        _UpperCAmelCase          =   list(lowerCAmelCase_     )
        _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(lowerCAmelCase_     )
        _UpperCAmelCase          =   list(lowerCAmelCase_     )
        _UpperCAmelCase          =   list(lowerCAmelCase_     )
        _UpperCAmelCase          =   xvector_output_dim







    @property
    def      _snake_case					(			self			:       int     )		->int:






        '''simple docstring'''






        return functools.reduce(operator.mul     ,					self.conv_stride     ,					1     )

"""simple docstring"""



from typing import TYPE_CHECKING

from ...utils import OptionalDependencyNotAvailable, _LazyModule, is_torch_available


a					:	Tuple							=		{
    '''configuration_pegasus_x''': ['''PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''PegasusXConfig'''],
}

try:
 if not is_torch_available():
  raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
 pass
else:
 a					:	List[str]							=		[
     '''PEGASUS_X_PRETRAINED_MODEL_ARCHIVE_LIST''',
     '''PegasusXForConditionalGeneration''',
     '''PegasusXModel''',
     '''PegasusXPreTrainedModel''',
 ]


if TYPE_CHECKING:
 from .configuration_pegasus_x import PEGASUS_X_PRETRAINED_CONFIG_ARCHIVE_MAP, PegasusXConfig

 try:
  if not is_torch_available():
   raise OptionalDependencyNotAvailable()
 except OptionalDependencyNotAvailable:
  pass
 else:
  from .modeling_pegasus_x import (
      PEGASUS_X_PRETRAINED_MODEL_ARCHIVE_LIST,
      PegasusXForConditionalGeneration,
      PegasusXModel,
      PegasusXPreTrainedModel,
  )


else:
 import sys

 a					:	Dict							=		_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)