




'''simple docstring'''






import functools
import operator

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


A_			      =		logging.get_logger(__name__)

A_			      =		{
    '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        lowercase_      (						snake_case_							):
     A_											=			"unispeech-sat"





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

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

           # ctc loss
           snake_case__       :   int	      =    ctc_loss_reduction
           snake_case__       :   Tuple	      =    ctc_zero_infinity

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

           # XVector-specific parameters. Feel free to ignore for other classes.
           snake_case__       :   Union[str, Any]	      =    list(A_			)
           snake_case__       :   Union[str, Any]	      =    list(A_			)
           snake_case__       :   int	      =    list(A_			)
           snake_case__       :   List[Any]	      =    xvector_output_dim





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


'''simple docstring'''
from typing import TYPE_CHECKING

from ...utils import (
    OptionalDependencyNotAvailable,
    _LazyModule,
    is_flax_available,
    is_sentencepiece_available,
    is_tf_available,
    is_tokenizers_available,
    is_torch_available,
)


if is_sentencepiece_available():
						from ..ta.tokenization_ta import TaTokenizer
else:
						from ...utils.dummy_sentencepiece_objects import TaTokenizer

lowerCAmelCase					:    Tuple           = TaTokenizer

if is_tokenizers_available():
						from ..ta.tokenization_ta_fast import TaTokenizerFast
else:
						from ...utils.dummy_tokenizers_objects import TaTokenizerFast

lowerCAmelCase					:    Optional[int]           = TaTokenizerFast

lowerCAmelCase					:    Any           = {'configuration_mt5': ['MT5Config', 'MT5OnnxConfig']}

try:
						if not is_torch_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase					:    Optional[int]           = [
						    'MT5EncoderModel',
						    'MT5ForConditionalGeneration',
						    'MT5ForQuestionAnswering',
						    'MT5Model',
						    'MT5PreTrainedModel',
						    'MT5Stack',
						]

try:
						if not is_tf_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase					:    Dict           = ['TFMT5EncoderModel', 'TFMT5ForConditionalGeneration', 'TFMT5Model']

try:
						if not is_flax_available():
												raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
						pass
else:
						lowerCAmelCase					:    Optional[Any]           = ['FlaxMT5EncoderModel', 'FlaxMT5ForConditionalGeneration', 'FlaxMT5Model']


if TYPE_CHECKING:
						from .configuration_mta import MTaConfig, MTaOnnxConfig

						try:
												if not is_torch_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_mta import (
												    MTaEncoderModel,
												    MTaForConditionalGeneration,
												    MTaForQuestionAnswering,
												    MTaModel,
												    MTaPreTrainedModel,
												    MTaStack,
												)

						try:
												if not is_tf_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_tf_mta import TFMTaEncoderModel, TFMTaForConditionalGeneration, TFMTaModel

						try:
												if not is_flax_available():
																		raise OptionalDependencyNotAvailable()
						except OptionalDependencyNotAvailable:
												pass
						else:
												from .modeling_flax_mta import FlaxMTaEncoderModel, FlaxMTaForConditionalGeneration, FlaxMTaModel

else:
						import sys

						lowerCAmelCase					:    Tuple           = _LazyModule(
						    __name__,
						    globals()['__file__'],
						    _import_structure,
						    extra_objects={'MT5Tokenizer': MTaTokenizer, 'MT5TokenizerFast': MTaTokenizerFast},
						    module_spec=__spec__,
						)




