


"""simple docstring"""
import functools
import operator

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


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

SCREAMING_SNAKE_CASE :    str									=				{
    """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				):






		'''simple docstring'''

		lowerCamelCase__				='unispeech'



		def __init__(self				,       a_=32				,       a_=7_68				,       a_=12				,       a_=12				,       a_=30_72				,       a_="gelu"				,       a_=0.1				,       a_=0.1				,       a_=0.1				,       a_=0.0				,       a_=0.0				,       a_=0.1				,       a_=0.1				,       a_=0.02				,       a_=1E-5				,       a_="group"				,       a_="gelu"				,       a_=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)				,       a_=(5, 2, 2, 2, 2, 2, 2)				,       a_=(10, 3, 3, 3, 3, 2, 2)				,       a_=False				,       a_=1_28				,       a_=16				,       a_=False				,       a_=True				,       a_=0.05				,       a_=10				,       a_=2				,       a_=0.0				,       a_=10				,       a_=0				,       a_=3_20				,       a_=2				,       a_=0.1				,       a_=1_00				,       a_=2_56				,       a_=2_56				,       a_=0.1				,       a_="mean"				,       a_=False				,       a_=False				,       a_=2_56				,       a_=80				,       a_=0				,       a_=1				,       a_=2				,       a_=0.5				,       **a_				,       ):





			'''simple docstring'''

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

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

			# ctc loss
			__snake_case	:						Any						=				ctc_loss_reduction
			__snake_case	:						Optional[Any]						=				ctc_zero_infinity

			# pretraining loss
			__snake_case	:						List[str]						=				replace_prob



		@property
		def 				SCREAMING_SNAKE_CASE  (self					):





			'''simple docstring'''

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









"""simple docstring"""
import numpy as np






def 		lowercase							(     _snake_case						:      int     ,   _snake_case						:      Optional[Any]     ,   _snake_case						:      Optional[int]     ,   _snake_case						:      int     ,   _snake_case						:      Union[str, Any]     )     ->Dict:
	"""simple docstring"""





	__snake_case	:						Union[str, Any]						=				int(np.ceil((x_end - xa) / h     )     )
	__snake_case	:						Dict						=				np.zeros((n + 1,)     )
	__snake_case	:						List[Any]						=				ya
	__snake_case	:						int						=				xa

	for k in range(_snake_case     ):
		__snake_case	:						Any						=				f(_snake_case     ,   y[k]     )
		__snake_case	:						List[Any]						=				f(x + 0.5 * h     ,   y[k] + 0.5 * h * ka     )
		__snake_case	:						int						=				f(x + 0.5 * h     ,   y[k] + 0.5 * h * ka     )
		__snake_case	:						Optional[int]						=				f(x + h     ,   y[k] + h * ka     )
		__snake_case	:						Optional[int]						=				y[k] + (1 / 6) * h * (ka + 2 * ka + 2 * ka + ka)
		x += h

	return y


if __name__ == "__main__":
			import doctest

			doctest.testmod()





