



'''simple docstring'''

import functools
import operator

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


_A				:    Tuple     						=logging.get_logger(__name__)

_A				:    Dict     						={
    '''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__      (						A     ):




					'''simple docstring'''



					A_						    =						"""unispeech-sat"""




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



						'''simple docstring'''





						super().__init__(**UpperCamelCase_     ,  pad_token_id=UpperCamelCase_     ,  bos_token_id=UpperCamelCase_     ,  eos_token_id=UpperCamelCase_					)
						_lowercase					:       int       =		hidden_size
						_lowercase					:       Union[str, Any]       =		feat_extract_norm
						_lowercase					:       Union[str, Any]       =		feat_extract_activation
						_lowercase					:       Optional[Any]       =		list(UpperCamelCase_					)
						_lowercase					:       Optional[int]       =		list(UpperCamelCase_					)
						_lowercase					:       Dict       =		list(UpperCamelCase_					)
						_lowercase					:       Tuple       =		conv_bias
						_lowercase					:       Dict       =		num_conv_pos_embeddings
						_lowercase					:       List[Any]       =		num_conv_pos_embedding_groups
						_lowercase					:       List[Any]       =		len(self.conv_dim					)
						_lowercase					:       List[str]       =		num_hidden_layers
						_lowercase					:       List[Any]       =		intermediate_size
						_lowercase					:       List[Any]       =		hidden_act
						_lowercase					:       int       =		num_attention_heads
						_lowercase					:       Dict       =		hidden_dropout
						_lowercase					:       Optional[Any]       =		attention_dropout
						_lowercase					:       List[str]       =		activation_dropout
						_lowercase					:       List[Any]       =		feat_proj_dropout
						_lowercase					:       Optional[int]       =		final_dropout
						_lowercase					:       List[str]       =		layerdrop
						_lowercase					:       Optional[Any]       =		layer_norm_eps
						_lowercase					:       Optional[int]       =		initializer_range
						_lowercase					:       Tuple       =		vocab_size
						_lowercase					:       List[str]       =		num_clusters
						_lowercase					:       Tuple       =		do_stable_layer_norm
						_lowercase					:       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
						_lowercase					:       Tuple       =		apply_spec_augment
						_lowercase					:       List[str]       =		mask_time_prob
						_lowercase					:       List[str]       =		mask_time_length
						_lowercase					:       Dict       =		mask_time_min_masks
						_lowercase					:       List[str]       =		mask_feature_prob
						_lowercase					:       Optional[int]       =		mask_feature_length
						_lowercase					:       Tuple       =		mask_feature_min_masks

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

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

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

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




					@property
					def 						__UpperCAmelCase     (  self				:	Union[str, Any]					)  ->       Optional[int]:



						'''simple docstring'''





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





'''simple docstring'''

from typing import TYPE_CHECKING

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


_A				:    Union[str, Any]     						={'''configuration_reformer''': ['''REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP''', '''ReformerConfig''']}

try:
		if not is_sentencepiece_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_A				:    Dict     						=['''ReformerTokenizer''']

try:
		if not is_tokenizers_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_A				:    Union[str, Any]     						=['''ReformerTokenizerFast''']

try:
		if not is_torch_available():
				raise OptionalDependencyNotAvailable()
except OptionalDependencyNotAvailable:
		pass
else:
		_A				:    str     						=[
		    '''REFORMER_PRETRAINED_MODEL_ARCHIVE_LIST''',
		    '''ReformerAttention''',
		    '''ReformerForMaskedLM''',
		    '''ReformerForQuestionAnswering''',
		    '''ReformerForSequenceClassification''',
		    '''ReformerLayer''',
		    '''ReformerModel''',
		    '''ReformerModelWithLMHead''',
		    '''ReformerPreTrainedModel''',
		]


if TYPE_CHECKING:
		from .configuration_reformer import REFORMER_PRETRAINED_CONFIG_ARCHIVE_MAP, ReformerConfig

		try:
				if not is_sentencepiece_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_reformer import ReformerTokenizer

		try:
				if not is_tokenizers_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .tokenization_reformer_fast import ReformerTokenizerFast

		try:
				if not is_torch_available():
						raise OptionalDependencyNotAvailable()
		except OptionalDependencyNotAvailable:
				pass
		else:
				from .modeling_reformer import (
				    REFORMER_PRETRAINED_MODEL_ARCHIVE_LIST,
				    ReformerAttention,
				    ReformerForMaskedLM,
				    ReformerForQuestionAnswering,
				    ReformerForSequenceClassification,
				    ReformerLayer,
				    ReformerModel,
				    ReformerModelWithLMHead,
				    ReformerPreTrainedModel,
				)

else:
		import sys

		_A				:    Union[str, Any]     						=_LazyModule(__name__, globals()['''__file__'''], _import_structure, module_spec=__spec__)
