





import functools
import operator

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


UpperCAmelCase__						:			Tuple									=logging.get_logger(__name__)

UpperCAmelCase__						:			Any									={
    '''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       __A     (						a    ):
				__A      =				"""unispeech-sat"""


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

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

								# ctc loss
								lowerCamelCase	 =ctc_loss_reduction
								lowerCamelCase	 =ctc_zero_infinity

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

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


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












from typing import TYPE_CHECKING

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


UpperCAmelCase__						:			str									={'''configuration_fnet''': ['''FNET_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''FNetConfig''']}

try:
							if not is_sentencepiece_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__						:			List[Any]									=['''FNetTokenizer''']

try:
							if not is_tokenizers_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__						:			Any									=['''FNetTokenizerFast''']

try:
							if not is_torch_available():
														raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
							pass
else:
							UpperCAmelCase__						:			Dict									=[
							    '''FNET_PRETRAINED_MODEL_ARCHIVE_LIST''',
							    '''FNetForMaskedLM''',
							    '''FNetForMultipleChoice''',
							    '''FNetForNextSentencePrediction''',
							    '''FNetForPreTraining''',
							    '''FNetForQuestionAnswering''',
							    '''FNetForSequenceClassification''',
							    '''FNetForTokenClassification''',
							    '''FNetLayer''',
							    '''FNetModel''',
							    '''FNetPreTrainedModel''',
							]


if TYPE_CHECKING:
							from .configuration_fnet import FNET_PRETRAINED_CONFIG_ARCHIVE_MAP, FNetConfig

							try:
														if not is_sentencepiece_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_fnet import FNetTokenizer

							try:
														if not is_tokenizers_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .tokenization_fnet_fast import FNetTokenizerFast

							try:
														if not is_torch_available():
																					raise OptionalDependencyNotAvailable()
							except OptionalDependencyNotAvailable:
														pass
							else:
														from .modeling_fnet import (
														    FNET_PRETRAINED_MODEL_ARCHIVE_LIST,
														    FNetForMaskedLM,
														    FNetForMultipleChoice,
														    FNetForNextSentencePrediction,
														    FNetForPreTraining,
														    FNetForQuestionAnswering,
														    FNetForSequenceClassification,
														    FNetForTokenClassification,
														    FNetLayer,
														    FNetModel,
														    FNetPreTrainedModel,
														)


else:
							import sys

							UpperCAmelCase__						:			Optional[int]									=_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)





