




'''simple docstring'''

import functools
import operator

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


a  :				Union[str, Any]									=  logging.get_logger(__name__)

a  :				Optional[int]									=  {
    'microsoft/unispeech-large-1500h-cv': (
        'https://huggingface.co/microsoft/unispeech-large-1500h-cv/resolve/main/config.json'
    ),
    # See all UniSpeech models at https://huggingface.co/models?filter=unispeech
}






class 						a				(   _lowerCamelCase     ):
				snake_case_      =		"unispeech"


				def __init__(		self    :					int       ,				lowercase_    :					Any=32       ,				lowercase_    :					Optional[int]=768       ,				lowercase_    :					Union[str, Any]=12       ,				lowercase_    :					Optional[int]=12       ,				lowercase_    :					List[Any]=3072       ,				lowercase_    :					Tuple="gelu"       ,				lowercase_    :					Tuple=0.1       ,				lowercase_    :					Optional[Any]=0.1       ,				lowercase_    :					Tuple=0.1       ,				lowercase_    :					List[str]=0.0       ,				lowercase_    :					List[str]=0.0       ,				lowercase_    :					Tuple=0.1       ,				lowercase_    :					Tuple=0.1       ,				lowercase_    :					List[str]=0.02       ,				lowercase_    :					str=1e-5       ,				lowercase_    :					Optional[int]="group"       ,				lowercase_    :					Union[str, Any]="gelu"       ,				lowercase_    :					List[Any]=(512, 512, 512, 512, 512, 512, 512)       ,				lowercase_    :					List[str]=(5, 2, 2, 2, 2, 2, 2)       ,				lowercase_    :					Dict=(10, 3, 3, 3, 3, 2, 2)       ,				lowercase_    :					Optional[Any]=False       ,				lowercase_    :					Optional[Any]=128       ,				lowercase_    :					Any=16       ,				lowercase_    :					Optional[int]=False       ,				lowercase_    :					List[str]=True       ,				lowercase_    :					Optional[int]=0.05       ,				lowercase_    :					Dict=10       ,				lowercase_    :					int=2       ,				lowercase_    :					Optional[int]=0.0       ,				lowercase_    :					Optional[Any]=10       ,				lowercase_    :					Dict=0       ,				lowercase_    :					str=320       ,				lowercase_    :					Dict=2       ,				lowercase_    :					Tuple=0.1       ,				lowercase_    :					Tuple=100       ,				lowercase_    :					Tuple=256       ,				lowercase_    :					str=256       ,				lowercase_    :					Union[str, Any]=0.1       ,				lowercase_    :					Any="mean"       ,				lowercase_    :					Union[str, Any]=False       ,				lowercase_    :					Tuple=False       ,				lowercase_    :					Tuple=256       ,				lowercase_    :					Tuple=80       ,				lowercase_    :					int=0       ,				lowercase_    :					List[str]=1       ,				lowercase_    :					Optional[int]=2       ,				lowercase_    :					Optional[Any]=0.5       ,				**lowercase_    :					Dict       ,				):
									super().__init__(**lowercase_       ,				pad_token_id=lowercase_       ,				bos_token_id=lowercase_       ,				eos_token_id=lowercase_					)
									snake_case_									=				hidden_size
									snake_case_									=				feat_extract_norm
									snake_case_									=				feat_extract_activation
									snake_case_									=				list(lowercase_					)
									snake_case_									=				list(lowercase_					)
									snake_case_									=				list(lowercase_					)
									snake_case_									=				conv_bias
									snake_case_									=				num_conv_pos_embeddings
									snake_case_									=				num_conv_pos_embedding_groups
									snake_case_									=				len(self.conv_dim					)
									snake_case_									=				num_hidden_layers
									snake_case_									=				intermediate_size
									snake_case_									=				hidden_act
									snake_case_									=				num_attention_heads
									snake_case_									=				hidden_dropout
									snake_case_									=				attention_dropout
									snake_case_									=				activation_dropout
									snake_case_									=				feat_proj_dropout
									snake_case_									=				final_dropout
									snake_case_									=				layerdrop
									snake_case_									=				layer_norm_eps
									snake_case_									=				initializer_range
									snake_case_									=				num_ctc_classes
									snake_case_									=				vocab_size
									snake_case_									=				do_stable_layer_norm
									snake_case_									=				use_weighted_layer_sum
									snake_case_									=				classifier_proj_size

									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_									=				apply_spec_augment
									snake_case_									=				mask_time_prob
									snake_case_									=				mask_time_length
									snake_case_									=				mask_time_min_masks
									snake_case_									=				mask_feature_prob
									snake_case_									=				mask_feature_length
									snake_case_									=				mask_feature_min_masks

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

									# ctc loss
									snake_case_									=				ctc_loss_reduction
									snake_case_									=				ctc_zero_infinity

									# pretraining loss
									snake_case_									=				replace_prob


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







'''simple docstring'''

from ..utils import DummyObject, requires_backends






class 						a				(   metaclass=_lowerCamelCase     ):
				snake_case_      =		["transformers", "torch", "note_seq"]


				def __init__(		self    :					Union[str, Any]       ,				*lowercase_    :					Optional[int]       ,				**lowercase_    :					int					):
									requires_backends(self       ,				['''transformers''', '''torch''', '''note_seq''']					)


				@classmethod
				def   A_ (		cls    :					List[Any]       ,				*lowercase_    :					Optional[Any]       ,				**lowercase_    :					str					):
									requires_backends(cls       ,				['''transformers''', '''torch''', '''note_seq''']					)


				@classmethod
				def   A_ (		cls    :					Tuple       ,				*lowercase_    :					Union[str, Any]       ,				**lowercase_    :					List[Any]					):
									requires_backends(cls       ,				['''transformers''', '''torch''', '''note_seq''']					)

