


import functools
import operator

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


_snake_case					:		Optional[Any]      =    logging.get_logger(__name__)

_snake_case					:		List[Any]      =    {
    "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"""


							__UpperCAmelCase   :							Tuple					  =  "wav2vec2"

							def __init__(							self	:  str   ,     lowerCamelCase	:  List[Any]=32   ,     lowerCamelCase	:  Any=768   ,     lowerCamelCase	:  Dict=12   ,     lowerCamelCase	:  Optional[int]=12   ,     lowerCamelCase	:  Optional[int]=3072   ,     lowerCamelCase	:  List[Any]="gelu"   ,     lowerCamelCase	:  Optional[int]=0.1   ,     lowerCamelCase	:  str=0.1   ,     lowerCamelCase	:  List[Any]=0.1   ,     lowerCamelCase	:  str=0.0   ,     lowerCamelCase	:  List[Any]=0.0   ,     lowerCamelCase	:  List[str]=0.1   ,     lowerCamelCase	:  List[Any]=0.1   ,     lowerCamelCase	:  Any=0.02   ,     lowerCamelCase	:  Optional[Any]=1E-5   ,     lowerCamelCase	:  Union[str, Any]="group"   ,     lowerCamelCase	:  Tuple="gelu"   ,     lowerCamelCase	:  Dict=(512, 512, 512, 512, 512, 512, 512)   ,     lowerCamelCase	:  List[Any]=(5, 2, 2, 2, 2, 2, 2)   ,     lowerCamelCase	:  str=(10, 3, 3, 3, 3, 2, 2)   ,     lowerCamelCase	:  int=False   ,     lowerCamelCase	:  Optional[int]=128   ,     lowerCamelCase	:  Optional[int]=16   ,     lowerCamelCase	:  str=False   ,     lowerCamelCase	:  Tuple=True   ,     lowerCamelCase	:  Dict=0.05   ,     lowerCamelCase	:  Union[str, Any]=10   ,     lowerCamelCase	:  Any=2   ,     lowerCamelCase	:  Union[str, Any]=0.0   ,     lowerCamelCase	:  List[str]=10   ,     lowerCamelCase	:  str=0   ,     lowerCamelCase	:  Tuple=320   ,     lowerCamelCase	:  Optional[Any]=2   ,     lowerCamelCase	:  List[Any]=0.1   ,     lowerCamelCase	:  int=100   ,     lowerCamelCase	:  Union[str, Any]=256   ,     lowerCamelCase	:  Optional[int]=256   ,     lowerCamelCase	:  Optional[int]=0.1   ,     lowerCamelCase	:  Any="sum"   ,     lowerCamelCase	:  str=False   ,     lowerCamelCase	:  Dict=False   ,     lowerCamelCase	:  int=256   ,     lowerCamelCase	:  Tuple=(512, 512, 512, 512, 1500)   ,     lowerCamelCase	:  Optional[int]=(5, 3, 3, 1, 1)   ,     lowerCamelCase	:  int=(1, 2, 3, 1, 1)   ,     lowerCamelCase	:  int=512   ,     lowerCamelCase	:  Optional[Any]=0   ,     lowerCamelCase	:  List[str]=1   ,     lowerCamelCase	:  Any=2   ,     lowerCamelCase	:  Any=False   ,     lowerCamelCase	:  Any=3   ,     lowerCamelCase	:  List[str]=2   ,     lowerCamelCase	:  int=3   ,     lowerCamelCase	:  str=None   ,     lowerCamelCase	:  Dict=None   ,     **lowerCamelCase	:  str   ,     )     ->   Optional[int]:
														super().__init__(**lowerCamelCase   ,     pad_token_id=lowerCamelCase   ,     bos_token_id=lowerCamelCase   ,     eos_token_id=lowerCamelCase    )
														__snake_case		:      int										=       hidden_size
														__snake_case		:      Optional[Any]										=       feat_extract_norm
														__snake_case		:      Dict										=       feat_extract_activation
														__snake_case		:      Any										=       list(lowerCamelCase    )
														__snake_case		:      Union[str, Any]										=       list(lowerCamelCase    )
														__snake_case		:      Optional[Any]										=       list(lowerCamelCase    )
														__snake_case		:      str										=       conv_bias
														__snake_case		:      str										=       num_conv_pos_embeddings
														__snake_case		:      Union[str, Any]										=       num_conv_pos_embedding_groups
														__snake_case		:      List[Any]										=       len(self.conv_dim    )
														__snake_case		:      Optional[Any]										=       num_hidden_layers
														__snake_case		:      Tuple										=       intermediate_size
														__snake_case		:      List[Any]										=       hidden_act
														__snake_case		:      int										=       num_attention_heads
														__snake_case		:      List[str]										=       hidden_dropout
														__snake_case		:      Dict										=       attention_dropout
														__snake_case		:      Dict										=       activation_dropout
														__snake_case		:      Tuple										=       feat_proj_dropout
														__snake_case		:      Any										=       final_dropout
														__snake_case		:      Union[str, Any]										=       layerdrop
														__snake_case		:      List[str]										=       layer_norm_eps
														__snake_case		:      Optional[Any]										=       initializer_range
														__snake_case		:      Tuple										=       vocab_size
														__snake_case		:      int										=       do_stable_layer_norm
														__snake_case		:      Any										=       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
														__snake_case		:      Optional[Any]										=       apply_spec_augment
														__snake_case		:      int										=       mask_time_prob
														__snake_case		:      Optional[int]										=       mask_time_length
														__snake_case		:      Tuple										=       mask_time_min_masks
														__snake_case		:      Tuple										=       mask_feature_prob
														__snake_case		:      Optional[Any]										=       mask_feature_length
														__snake_case		:      Tuple										=       mask_feature_min_masks

														# parameters for pretraining with codevector quantized representations
														__snake_case		:      Optional[int]										=       num_codevectors_per_group
														__snake_case		:      List[str]										=       num_codevector_groups
														__snake_case		:      List[str]										=       contrastive_logits_temperature
														__snake_case		:      List[Any]										=       feat_quantizer_dropout
														__snake_case		:      List[Any]										=       num_negatives
														__snake_case		:      Tuple										=       codevector_dim
														__snake_case		:      List[str]										=       proj_codevector_dim
														__snake_case		:      int										=       diversity_loss_weight

														# ctc loss
														__snake_case		:      Optional[Any]										=       ctc_loss_reduction
														__snake_case		:      Any										=       ctc_zero_infinity

														# adapter
														__snake_case		:      Optional[int]										=       add_adapter
														__snake_case		:      Union[str, Any]										=       adapter_kernel_size
														__snake_case		:      int										=       adapter_stride
														__snake_case		:      Tuple										=       num_adapter_layers
														__snake_case		:      List[Any]										=       output_hidden_size or hidden_size
														__snake_case		:      Dict										=       adapter_attn_dim

														# SequenceClassification-specific parameter. Feel free to ignore for other classes.
														__snake_case		:      Optional[Any]										=       classifier_proj_size

														# XVector-specific parameters. Feel free to ignore for other classes.
														__snake_case		:      Optional[int]										=       list(lowerCamelCase    )
														__snake_case		:      List[str]										=       list(lowerCamelCase    )
														__snake_case		:      Optional[int]										=       list(lowerCamelCase    )
														__snake_case		:      List[Any]										=       xvector_output_dim






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





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


_snake_case					:		Any      =    logging.get_logger(__name__)

_snake_case					:		Dict      =    {
    "facebook/s2t-wav2vec2-large-en-de": (
        "https://huggingface.co/facebook/s2t-wav2vec2-large-en-de/resolve/main/config.json"
    ),
    # See all Speech2Text models at https://huggingface.co/models?filter=speech2text2
}

class     a		(_lowerCAmelCase				):




							"""simple docstring"""


							__UpperCAmelCase   :							Union[str, Any]					  =  "speech_to_text_2"
							__UpperCAmelCase   :							Dict					  =  ["past_key_values"]
							__UpperCAmelCase   :							str					  =  {"num_attention_heads": "decoder_attention_heads", "hidden_size": "d_model"}

							def __init__(							self	:  str   ,     lowerCamelCase	:  List[Any]=10000   ,     lowerCamelCase	:  Tuple=6   ,     lowerCamelCase	:  Optional[Any]=2048   ,     lowerCamelCase	:  Optional[int]=4   ,     lowerCamelCase	:  Optional[int]=0.0   ,     lowerCamelCase	:  str=True   ,     lowerCamelCase	:  str="relu"   ,     lowerCamelCase	:  Tuple=256   ,     lowerCamelCase	:  Union[str, Any]=0.1   ,     lowerCamelCase	:  Optional[int]=0.0   ,     lowerCamelCase	:  Any=0.0   ,     lowerCamelCase	:  Optional[int]=0.02   ,     lowerCamelCase	:  Dict=2   ,     lowerCamelCase	:  List[str]=True   ,     lowerCamelCase	:  str=1   ,     lowerCamelCase	:  Any=0   ,     lowerCamelCase	:  List[Any]=2   ,     lowerCamelCase	:  List[Any]=1024   ,     **lowerCamelCase	:  List[str]   ,     )     ->   Any:
														__snake_case		:      Tuple										=       vocab_size
														__snake_case		:      int										=       d_model
														__snake_case		:      List[str]										=       decoder_ffn_dim
														__snake_case		:      Union[str, Any]										=       decoder_layers
														__snake_case		:      Dict										=       decoder_attention_heads
														__snake_case		:      Any										=       dropout
														__snake_case		:      List[str]										=       attention_dropout
														__snake_case		:      Optional[Any]										=       activation_dropout
														__snake_case		:      Union[str, Any]										=       activation_function
														__snake_case		:      Union[str, Any]										=       init_std
														__snake_case		:      Union[str, Any]										=       decoder_layerdrop
														__snake_case		:      Optional[int]										=       use_cache
														__snake_case		:      Optional[int]										=       decoder_layers
														__snake_case		:      str										=       scale_embedding  # scale factor will be sqrt(d_model) if True
														__snake_case		:      Dict										=       max_target_positions

														super().__init__(
														    pad_token_id=lowerCamelCase   ,     bos_token_id=lowerCamelCase   ,     eos_token_id=lowerCamelCase   ,     decoder_start_token_id=lowerCamelCase   ,     **lowerCamelCase   ,     )

