





import functools
import operator

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


UpperCamelCase__      =logging.get_logger(__name__)

UpperCamelCase__      ={
    '''microsoft/unispeech-sat-base-100h-libri-ft''': (
        '''https://huggingface.co/microsoft/unispeech-sat-base-100h-libri-ft/resolve/main/config.json'''
    ),
    # See all UniSpeechSat models at https://huggingface.co/models?filter=unispeech_sat
}





class 			lowerCAmelCase__( __lowercase    ):






       '''simple docstring'''


       __snake_case 			=    'unispeech-sat'




       def __init__(      self    ,						__lowerCamelCase=3_2    ,						__lowerCamelCase=7_6_8    ,						__lowerCamelCase=1_2    ,						__lowerCamelCase=1_2    ,						__lowerCamelCase=3_0_7_2    ,						__lowerCamelCase="gelu"    ,						__lowerCamelCase=0.1    ,						__lowerCamelCase=0.1    ,						__lowerCamelCase=0.1    ,						__lowerCamelCase=0.0    ,						__lowerCamelCase=0.0    ,						__lowerCamelCase=0.1    ,						__lowerCamelCase=0.1    ,						__lowerCamelCase=0.02    ,						__lowerCamelCase=1E-5    ,						__lowerCamelCase="group"    ,						__lowerCamelCase="gelu"    ,						__lowerCamelCase=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)    ,						__lowerCamelCase=(5, 2, 2, 2, 2, 2, 2)    ,						__lowerCamelCase=(1_0, 3, 3, 3, 3, 2, 2)    ,						__lowerCamelCase=False    ,						__lowerCamelCase=1_2_8    ,						__lowerCamelCase=1_6    ,						__lowerCamelCase=False    ,						__lowerCamelCase=True    ,						__lowerCamelCase=0.05    ,						__lowerCamelCase=1_0    ,						__lowerCamelCase=2    ,						__lowerCamelCase=0.0    ,						__lowerCamelCase=1_0    ,						__lowerCamelCase=0    ,						__lowerCamelCase=3_2_0    ,						__lowerCamelCase=2    ,						__lowerCamelCase=0.1    ,						__lowerCamelCase=1_0_0    ,						__lowerCamelCase=2_5_6    ,						__lowerCamelCase=2_5_6    ,						__lowerCamelCase=0.1    ,						__lowerCamelCase="mean"    ,						__lowerCamelCase=False    ,						__lowerCamelCase=False    ,						__lowerCamelCase=2_5_6    ,						__lowerCamelCase=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 1_5_0_0)    ,						__lowerCamelCase=(5, 3, 3, 1, 1)    ,						__lowerCamelCase=(1, 2, 3, 1, 1)    ,						__lowerCamelCase=5_1_2    ,						__lowerCamelCase=0    ,						__lowerCamelCase=1    ,						__lowerCamelCase=2    ,						__lowerCamelCase=5_0_4    ,						**__lowerCamelCase    ,						)			->     List[Any]:
            super().__init__(**UpperCamelCase_    ,						pad_token_id=UpperCamelCase_    ,						bos_token_id=UpperCamelCase_    ,						eos_token_id=UpperCamelCase_							)
            _SCREAMING_SNAKE_CASE       :	int						    =							hidden_size
            _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							feat_extract_norm
            _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							feat_extract_activation
            _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							list(UpperCamelCase_							)
            _SCREAMING_SNAKE_CASE       :	Optional[int]						    =							list(UpperCamelCase_							)
            _SCREAMING_SNAKE_CASE       :	Dict						    =							list(UpperCamelCase_							)
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							conv_bias
            _SCREAMING_SNAKE_CASE       :	Dict						    =							num_conv_pos_embeddings
            _SCREAMING_SNAKE_CASE       :	List[Any]						    =							num_conv_pos_embedding_groups
            _SCREAMING_SNAKE_CASE       :	List[Any]						    =							len(self.conv_dim							)
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							num_hidden_layers
            _SCREAMING_SNAKE_CASE       :	List[Any]						    =							intermediate_size
            _SCREAMING_SNAKE_CASE       :	List[Any]						    =							hidden_act
            _SCREAMING_SNAKE_CASE       :	int						    =							num_attention_heads
            _SCREAMING_SNAKE_CASE       :	Dict						    =							hidden_dropout
            _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							attention_dropout
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							activation_dropout
            _SCREAMING_SNAKE_CASE       :	List[Any]						    =							feat_proj_dropout
            _SCREAMING_SNAKE_CASE       :	Optional[int]						    =							final_dropout
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							layerdrop
            _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							layer_norm_eps
            _SCREAMING_SNAKE_CASE       :	Optional[int]						    =							initializer_range
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							vocab_size
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							num_clusters
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							do_stable_layer_norm
            _SCREAMING_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
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							apply_spec_augment
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							mask_time_prob
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							mask_time_length
            _SCREAMING_SNAKE_CASE       :	Dict						    =							mask_time_min_masks
            _SCREAMING_SNAKE_CASE       :	List[str]						    =							mask_feature_prob
            _SCREAMING_SNAKE_CASE       :	Optional[int]						    =							mask_feature_length
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							mask_feature_min_masks

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

            # ctc loss
            _SCREAMING_SNAKE_CASE       :	List[Any]						    =							ctc_loss_reduction
            _SCREAMING_SNAKE_CASE       :	Dict						    =							ctc_zero_infinity

            # SequenceClassification-specific parameter. Feel free to ignore for other classes.
            _SCREAMING_SNAKE_CASE       :	Any						    =							classifier_proj_size

            # XVector-specific parameters. Feel free to ignore for other classes.
            _SCREAMING_SNAKE_CASE       :	Union[str, Any]						    =							list(UpperCamelCase_							)
            _SCREAMING_SNAKE_CASE       :	str						    =							list(UpperCamelCase_							)
            _SCREAMING_SNAKE_CASE       :	Tuple						    =							list(UpperCamelCase_							)
            _SCREAMING_SNAKE_CASE       :	Optional[Any]						    =							xvector_output_dim







       @property
       def     UpperCamelCase_			(      self							)			->     Optional[int]:
            return functools.reduce(operator.mul    ,						self.conv_stride    ,						1							)













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


UpperCamelCase__      =logging.get_logger(__name__)

UpperCamelCase__      ={
    '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 			lowerCAmelCase__( __lowercase    ):






       '''simple docstring'''


       __snake_case 			=    'speech_to_text_2'
       __snake_case 			=    ['past_key_values']
       __snake_case 			=    {'num_attention_heads': 'decoder_attention_heads', 'hidden_size': 'd_model'}




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

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