


import functools
import operator

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


__snake_case            =   logging.get_logger(__name__)

__snake_case            =   {
    "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    UpperCAmelCase					(       __snake_case    ):
			lowercase						= """unispeech"""




			def __init__(						self							:		str       ,       __magic_name__							:		Optional[Any]=3_2       ,       __magic_name__							:		Optional[Any]=7_6_8       ,       __magic_name__							:		Dict=1_2       ,       __magic_name__							:		List[str]=1_2       ,       __magic_name__							:		Any=3_0_7_2       ,       __magic_name__							:		List[Any]="gelu"       ,       __magic_name__							:		Tuple=0.1       ,       __magic_name__							:		Dict=0.1       ,       __magic_name__							:		Union[str, Any]=0.1       ,       __magic_name__							:		List[Any]=0.0       ,       __magic_name__							:		Any=0.0       ,       __magic_name__							:		int=0.1       ,       __magic_name__							:		int=0.1       ,       __magic_name__							:		int=0.02       ,       __magic_name__							:		Optional[int]=1e-5       ,       __magic_name__							:		Optional[int]="group"       ,       __magic_name__							:		Optional[Any]="gelu"       ,       __magic_name__							:		str=(5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2, 5_1_2)       ,       __magic_name__							:		Any=(5, 2, 2, 2, 2, 2, 2)       ,       __magic_name__							:		int=(1_0, 3, 3, 3, 3, 2, 2)       ,       __magic_name__							:		Union[str, Any]=False       ,       __magic_name__							:		Optional[int]=1_2_8       ,       __magic_name__							:		List[str]=1_6       ,       __magic_name__							:		Dict=False       ,       __magic_name__							:		Union[str, Any]=True       ,       __magic_name__							:		Any=0.05       ,       __magic_name__							:		Union[str, Any]=1_0       ,       __magic_name__							:		Dict=2       ,       __magic_name__							:		Any=0.0       ,       __magic_name__							:		Tuple=1_0       ,       __magic_name__							:		str=0       ,       __magic_name__							:		Dict=3_2_0       ,       __magic_name__							:		Tuple=2       ,       __magic_name__							:		Tuple=0.1       ,       __magic_name__							:		Tuple=1_0_0       ,       __magic_name__							:		int=2_5_6       ,       __magic_name__							:		List[str]=2_5_6       ,       __magic_name__							:		Dict=0.1       ,       __magic_name__							:		Optional[int]="mean"       ,       __magic_name__							:		Any=False       ,       __magic_name__							:		Optional[Any]=False       ,       __magic_name__							:		Any=2_5_6       ,       __magic_name__							:		Optional[int]=8_0       ,       __magic_name__							:		Dict=0       ,       __magic_name__							:		Tuple=1       ,       __magic_name__							:		Optional[int]=2       ,       __magic_name__							:		Optional[int]=0.5       ,       **__magic_name__							:		Any       ,       ):







						"""simple docstring"""







						super().__init__(**__magic_name__       ,       pad_token_id=__magic_name__       ,       bos_token_id=__magic_name__       ,       eos_token_id=__magic_name__						)
						UpperCamelCase         =					hidden_size
						UpperCamelCase         =					feat_extract_norm
						UpperCamelCase         =					feat_extract_activation
						UpperCamelCase         =					list(__magic_name__						)
						UpperCamelCase         =					list(__magic_name__						)
						UpperCamelCase         =					list(__magic_name__						)
						UpperCamelCase         =					conv_bias
						UpperCamelCase         =					num_conv_pos_embeddings
						UpperCamelCase         =					num_conv_pos_embedding_groups
						UpperCamelCase         =					len(self.conv_dim						)
						UpperCamelCase         =					num_hidden_layers
						UpperCamelCase         =					intermediate_size
						UpperCamelCase         =					hidden_act
						UpperCamelCase         =					num_attention_heads
						UpperCamelCase         =					hidden_dropout
						UpperCamelCase         =					attention_dropout
						UpperCamelCase         =					activation_dropout
						UpperCamelCase         =					feat_proj_dropout
						UpperCamelCase         =					final_dropout
						UpperCamelCase         =					layerdrop
						UpperCamelCase         =					layer_norm_eps
						UpperCamelCase         =					initializer_range
						UpperCamelCase         =					num_ctc_classes
						UpperCamelCase         =					vocab_size
						UpperCamelCase         =					do_stable_layer_norm
						UpperCamelCase         =					use_weighted_layer_sum
						UpperCamelCase         =					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
						UpperCamelCase         =					apply_spec_augment
						UpperCamelCase         =					mask_time_prob
						UpperCamelCase         =					mask_time_length
						UpperCamelCase         =					mask_time_min_masks
						UpperCamelCase         =					mask_feature_prob
						UpperCamelCase         =					mask_feature_length
						UpperCamelCase         =					mask_feature_min_masks

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

						# ctc loss
						UpperCamelCase         =					ctc_loss_reduction
						UpperCamelCase         =					ctc_zero_infinity

						# pretraining loss
						UpperCamelCase         =					replace_prob





			@property
			def   lowerCamelCase_					(						self							:		Any						):







						"""simple docstring"""







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








def 							_lowercase    (		SCREAMING_SNAKE_CASE_   :		str	):





			"""simple docstring"""




			return [
			    txt[:a] + txt[a].upper() + txt[a + 1 :]
			    for a in range(len(SCREAMING_SNAKE_CASE_	)	)
			    if txt[a].isalpha()
			]


if __name__ == "__main__":
			__import__("doctest").testmod()




