





import functools
import operator

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


SCREAMING_SNAKE_CASE_		     = logging.get_logger(__name__)

SCREAMING_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'''

     __snake_case					:			Tuple				=    "wav2vec2"






     def __init__(							self		:					List[Any]		,lowerCamelCase__		:					Union[str, Any]=32		,lowerCamelCase__		:					int=768		,lowerCamelCase__		:					Optional[Any]=12		,lowerCamelCase__		:					Union[str, Any]=12		,lowerCamelCase__		:					Union[str, Any]=3072		,lowerCamelCase__		:					Tuple="gelu"		,lowerCamelCase__		:					List[Any]=0.1		,lowerCamelCase__		:					int=0.1		,lowerCamelCase__		:					Any=0.1		,lowerCamelCase__		:					Optional[Any]=0.0		,lowerCamelCase__		:					Tuple=0.0		,lowerCamelCase__		:					Optional[int]=0.1		,lowerCamelCase__		:					Tuple=0.1		,lowerCamelCase__		:					List[str]=0.02		,lowerCamelCase__		:					Optional[Any]=1e-5		,lowerCamelCase__		:					List[Any]="group"		,lowerCamelCase__		:					Dict="gelu"		,lowerCamelCase__		:					Union[str, Any]=(512, 512, 512, 512, 512, 512, 512)		,lowerCamelCase__		:					Optional[Any]=(5, 2, 2, 2, 2, 2, 2)		,lowerCamelCase__		:					Any=(10, 3, 3, 3, 3, 2, 2)		,lowerCamelCase__		:					Dict=False		,lowerCamelCase__		:					List[str]=128		,lowerCamelCase__		:					Union[str, Any]=16		,lowerCamelCase__		:					List[str]=False		,lowerCamelCase__		:					int=True		,lowerCamelCase__		:					Any=0.05		,lowerCamelCase__		:					Union[str, Any]=10		,lowerCamelCase__		:					List[str]=2		,lowerCamelCase__		:					List[Any]=0.0		,lowerCamelCase__		:					List[str]=10		,lowerCamelCase__		:					Union[str, Any]=0		,lowerCamelCase__		:					List[str]=320		,lowerCamelCase__		:					List[str]=2		,lowerCamelCase__		:					List[str]=0.1		,lowerCamelCase__		:					Tuple=100		,lowerCamelCase__		:					Optional[Any]=256		,lowerCamelCase__		:					List[Any]=256		,lowerCamelCase__		:					str=0.1		,lowerCamelCase__		:					Dict="sum"		,lowerCamelCase__		:					List[str]=False		,lowerCamelCase__		:					Optional[int]=False		,lowerCamelCase__		:					Union[str, Any]=256		,lowerCamelCase__		:					Dict=(512, 512, 512, 512, 1500)		,lowerCamelCase__		:					Optional[int]=(5, 3, 3, 1, 1)		,lowerCamelCase__		:					Optional[int]=(1, 2, 3, 1, 1)		,lowerCamelCase__		:					List[str]=512		,lowerCamelCase__		:					Optional[Any]=0		,lowerCamelCase__		:					List[str]=1		,lowerCamelCase__		:					List[Any]=2		,lowerCamelCase__		:					Dict=False		,lowerCamelCase__		:					str=3		,lowerCamelCase__		:					int=2		,lowerCamelCase__		:					Optional[Any]=3		,lowerCamelCase__		:					str=None		,lowerCamelCase__		:					Tuple=None		,**lowerCamelCase__		:					Optional[Any]		,)  ->	int:




           '''simple docstring'''


           super().__init__(**UpperCAmelCase__		,pad_token_id=UpperCAmelCase__		,bos_token_id=UpperCAmelCase__		,eos_token_id=UpperCAmelCase__ )
           SCREAMING_SNAKE_CASE	=		hidden_size
           SCREAMING_SNAKE_CASE	=		feat_extract_norm
           SCREAMING_SNAKE_CASE	=		feat_extract_activation
           SCREAMING_SNAKE_CASE	=		list(UpperCAmelCase__ )
           SCREAMING_SNAKE_CASE	=		list(UpperCAmelCase__ )
           SCREAMING_SNAKE_CASE	=		list(UpperCAmelCase__ )
           SCREAMING_SNAKE_CASE	=		conv_bias
           SCREAMING_SNAKE_CASE	=		num_conv_pos_embeddings
           SCREAMING_SNAKE_CASE	=		num_conv_pos_embedding_groups
           SCREAMING_SNAKE_CASE	=		len(self.conv_dim )
           SCREAMING_SNAKE_CASE	=		num_hidden_layers
           SCREAMING_SNAKE_CASE	=		intermediate_size
           SCREAMING_SNAKE_CASE	=		hidden_act
           SCREAMING_SNAKE_CASE	=		num_attention_heads
           SCREAMING_SNAKE_CASE	=		hidden_dropout
           SCREAMING_SNAKE_CASE	=		attention_dropout
           SCREAMING_SNAKE_CASE	=		activation_dropout
           SCREAMING_SNAKE_CASE	=		feat_proj_dropout
           SCREAMING_SNAKE_CASE	=		final_dropout
           SCREAMING_SNAKE_CASE	=		layerdrop
           SCREAMING_SNAKE_CASE	=		layer_norm_eps
           SCREAMING_SNAKE_CASE	=		initializer_range
           SCREAMING_SNAKE_CASE	=		vocab_size
           SCREAMING_SNAKE_CASE	=		do_stable_layer_norm
           SCREAMING_SNAKE_CASE	=		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
           SCREAMING_SNAKE_CASE	=		apply_spec_augment
           SCREAMING_SNAKE_CASE	=		mask_time_prob
           SCREAMING_SNAKE_CASE	=		mask_time_length
           SCREAMING_SNAKE_CASE	=		mask_time_min_masks
           SCREAMING_SNAKE_CASE	=		mask_feature_prob
           SCREAMING_SNAKE_CASE	=		mask_feature_length
           SCREAMING_SNAKE_CASE	=		mask_feature_min_masks

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

           # ctc loss
           SCREAMING_SNAKE_CASE	=		ctc_loss_reduction
           SCREAMING_SNAKE_CASE	=		ctc_zero_infinity

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

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

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






     @property
     def        SCREAMING_SNAKE_CASE__						(							self		:					Any )  ->	Any:




           '''simple docstring'''


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









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


SCREAMING_SNAKE_CASE_		     = logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_		     = {
    """google/pegasus-large""": """https://huggingface.co/google/pegasus-large/resolve/main/config.json""",
    # See all PEGASUS models at https://huggingface.co/models?filter=pegasus
}

class 	UpperCamelCase__				(   lowerCAmelCase_     ):



     '''simple docstring'''

     __snake_case					:			str				=    "pegasus"
     __snake_case					:			List[Any]				=    ["past_key_values"]
     __snake_case					:			Any				=    {"num_attention_heads": "encoder_attention_heads", "hidden_size": "d_model"}






     def __init__(							self		:					Dict		,lowerCamelCase__		:					List[str]=50265		,lowerCamelCase__		:					int=1024		,lowerCamelCase__		:					Optional[Any]=12		,lowerCamelCase__		:					Tuple=4096		,lowerCamelCase__		:					Dict=16		,lowerCamelCase__		:					Optional[Any]=12		,lowerCamelCase__		:					str=4096		,lowerCamelCase__		:					Dict=16		,lowerCamelCase__		:					Tuple=0.0		,lowerCamelCase__		:					Dict=0.0		,lowerCamelCase__		:					str=True		,lowerCamelCase__		:					Any=True		,lowerCamelCase__		:					List[Any]="gelu"		,lowerCamelCase__		:					Tuple=1024		,lowerCamelCase__		:					Optional[int]=0.1		,lowerCamelCase__		:					Tuple=0.0		,lowerCamelCase__		:					Dict=0.0		,lowerCamelCase__		:					Optional[int]=0.02		,lowerCamelCase__		:					Optional[int]=0		,lowerCamelCase__		:					List[Any]=False		,lowerCamelCase__		:					Union[str, Any]=0		,lowerCamelCase__		:					Optional[int]=1		,lowerCamelCase__		:					Any=1		,**lowerCamelCase__		:					Dict		,)  ->	str:




           '''simple docstring'''


           SCREAMING_SNAKE_CASE	=		vocab_size
           SCREAMING_SNAKE_CASE	=		max_position_embeddings
           SCREAMING_SNAKE_CASE	=		d_model
           SCREAMING_SNAKE_CASE	=		encoder_ffn_dim
           SCREAMING_SNAKE_CASE	=		encoder_layers
           SCREAMING_SNAKE_CASE	=		encoder_attention_heads
           SCREAMING_SNAKE_CASE	=		decoder_ffn_dim
           SCREAMING_SNAKE_CASE	=		decoder_layers
           SCREAMING_SNAKE_CASE	=		decoder_attention_heads
           SCREAMING_SNAKE_CASE	=		dropout
           SCREAMING_SNAKE_CASE	=		attention_dropout
           SCREAMING_SNAKE_CASE	=		activation_dropout
           SCREAMING_SNAKE_CASE	=		activation_function
           SCREAMING_SNAKE_CASE	=		init_std
           SCREAMING_SNAKE_CASE	=		encoder_layerdrop
           SCREAMING_SNAKE_CASE	=		decoder_layerdrop
           SCREAMING_SNAKE_CASE	=		use_cache
           SCREAMING_SNAKE_CASE	=		encoder_layers
           SCREAMING_SNAKE_CASE	=		scale_embedding  # scale factor will be sqrt(d_model) if True
           super().__init__(
               pad_token_id=lowerCamelCase__		,eos_token_id=lowerCamelCase__		,is_encoder_decoder=lowerCamelCase__		,decoder_start_token_id=lowerCamelCase__		,forced_eos_token_id=lowerCamelCase__		,**lowerCamelCase__		,)






     @property
     def        SCREAMING_SNAKE_CASE__						(							self		:					Tuple )  ->	int:




           '''simple docstring'''


           return self.encoder_attention_heads






     @property
     def        SCREAMING_SNAKE_CASE__						(							self		:					List[str] )  ->	int:




           '''simple docstring'''


           return self.d_model


