






import functools
import operator

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


__UpperCAmelCase								=						logging.get_logger(__name__)

__UpperCAmelCase								=						{
    'asapp/sew-tiny-100k': 'https://huggingface.co/asapp/sew-tiny-100k/resolve/main/config.json',
    # See all SEW models at https://huggingface.co/models?filter=sew
}



class   lowerCamelCase      (_snake_case			):







		'''simple docstring'''



		_snake_case    :    Any       						=  '''sew'''



		def __init__(							self				,		_UpperCamelCase=3_2				,		_UpperCamelCase=7_6_8				,		_UpperCamelCase=1_2				,		_UpperCamelCase=1_2				,		_UpperCamelCase=3_0_7_2				,		_UpperCamelCase=2				,		_UpperCamelCase="gelu"				,		_UpperCamelCase=0.1				,		_UpperCamelCase=0.1				,		_UpperCamelCase=0.1				,		_UpperCamelCase=0.0				,		_UpperCamelCase=0.1				,		_UpperCamelCase=0.1				,		_UpperCamelCase=0.02				,		_UpperCamelCase=1E-5				,		_UpperCamelCase="group"				,		_UpperCamelCase="gelu"				,		_UpperCamelCase=(6_4, 1_2_8, 1_2_8, 1_2_8, 1_2_8, 2_5_6, 2_5_6, 2_5_6, 2_5_6, 5_1_2, 5_1_2, 5_1_2, 5_1_2)				,		_UpperCamelCase=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)				,		_UpperCamelCase=(1_0, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)				,		_UpperCamelCase=False				,		_UpperCamelCase=1_2_8				,		_UpperCamelCase=1_6				,		_UpperCamelCase=True				,		_UpperCamelCase=0.05				,		_UpperCamelCase=1_0				,		_UpperCamelCase=2				,		_UpperCamelCase=0.0				,		_UpperCamelCase=1_0				,		_UpperCamelCase=0				,		_UpperCamelCase="mean"				,		_UpperCamelCase=False				,		_UpperCamelCase=False				,		_UpperCamelCase=2_5_6				,		_UpperCamelCase=0				,		_UpperCamelCase=1				,		_UpperCamelCase=2				,		**_UpperCamelCase				,		)	->							Optional[Any]:
							super().__init__(**_UpperCamelCase				,		pad_token_id=_UpperCamelCase				,		bos_token_id=_UpperCamelCase				,		eos_token_id=_UpperCamelCase   )
							UpperCAmelCase_    :      str            =						hidden_size
							UpperCAmelCase_    :      str            =						feat_extract_norm
							UpperCAmelCase_    :      Union[str, Any]            =						feat_extract_activation
							UpperCAmelCase_    :      str            =						list(_UpperCamelCase   )
							UpperCAmelCase_    :      Union[str, Any]            =						list(_UpperCamelCase   )
							UpperCAmelCase_    :      Optional[Any]            =						list(_UpperCamelCase   )
							UpperCAmelCase_    :      Tuple            =						conv_bias
							UpperCAmelCase_    :      Dict            =						num_conv_pos_embeddings
							UpperCAmelCase_    :      Optional[int]            =						num_conv_pos_embedding_groups
							UpperCAmelCase_    :      Tuple            =						len(self.conv_dim   )
							UpperCAmelCase_    :      int            =						num_hidden_layers
							UpperCAmelCase_    :      int            =						intermediate_size
							UpperCAmelCase_    :      Tuple            =						squeeze_factor
							UpperCAmelCase_    :      Optional[Any]            =						hidden_act
							UpperCAmelCase_    :      Union[str, Any]            =						num_attention_heads
							UpperCAmelCase_    :      Tuple            =						hidden_dropout
							UpperCAmelCase_    :      Dict            =						attention_dropout
							UpperCAmelCase_    :      str            =						activation_dropout
							UpperCAmelCase_    :      Optional[Any]            =						feat_proj_dropout
							UpperCAmelCase_    :      Any            =						final_dropout
							UpperCAmelCase_    :      Optional[int]            =						layerdrop
							UpperCAmelCase_    :      List[Any]            =						layer_norm_eps
							UpperCAmelCase_    :      Tuple            =						initializer_range
							UpperCAmelCase_    :      Union[str, Any]            =						vocab_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)`,'
												    f"but is `len(config.conv_dim) = {len(self.conv_dim   )}`, `len(config.conv_stride)"
												    f"= {len(self.conv_stride   )}`, `len(config.conv_kernel) = {len(self.conv_kernel   )}`."   )

							# fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
							UpperCAmelCase_    :      Optional[Any]            =						apply_spec_augment
							UpperCAmelCase_    :      Optional[Any]            =						mask_time_prob
							UpperCAmelCase_    :      Any            =						mask_time_length
							UpperCAmelCase_    :      Union[str, Any]            =						mask_time_min_masks
							UpperCAmelCase_    :      List[str]            =						mask_feature_prob
							UpperCAmelCase_    :      Dict            =						mask_feature_length
							UpperCAmelCase_    :      List[str]            =						mask_feature_min_masks

							# ctc loss
							UpperCAmelCase_    :      str            =						ctc_loss_reduction
							UpperCAmelCase_    :      int            =						ctc_zero_infinity

							# sequence classification
							UpperCAmelCase_    :      List[Any]            =						use_weighted_layer_sum
							UpperCAmelCase_    :      Optional[Any]            =						classifier_proj_size



		@property
		def 					__UpperCAmelCase			(							self   )	->							Dict:
							return functools.reduce(operator.mul				,		self.conv_stride				,		1   )











"""simple docstring"""






from __future__ import annotations






def      snake_case__   (		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int	):
			"""simple docstring"""
			if b == 0:
						return (1, 0)
			((lowerCamelCase__)	,   (lowerCamelCase__))		:		Any			=extended_euclid(__lowerCamelCase							,		a % b	)
			lowerCamelCase__		:		Optional[Any]			=a // b
			return (y, x - k * y)






def      snake_case__   (		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int	):
			"""simple docstring"""
			((lowerCamelCase__)	,   (lowerCamelCase__))		:		Any			=extended_euclid(__lowerCamelCase							,		__lowerCamelCase	)
			lowerCamelCase__		:		List[Any]			=na * na
			lowerCamelCase__		:		Union[str, Any]			=ra * x * na + ra * y * na
			return (n % m + m) % m






def      snake_case__   (		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int	):
			"""simple docstring"""
			((lowerCamelCase__)	,   (lowerCamelCase__))		:		int			=extended_euclid(__lowerCamelCase							,		__lowerCamelCase	)
			if b < 0:
						lowerCamelCase__		:		Any			=(b % n + n) % n
			return b






def      snake_case__   (		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int							,		__lowerCamelCase				:    int	):
			"""simple docstring"""
			lowerCamelCase__	,   lowerCamelCase__		:		Any			=invert_modulo(__lowerCamelCase							,		__lowerCamelCase	), invert_modulo(__lowerCamelCase							,		__lowerCamelCase	)
			lowerCamelCase__		:		Tuple			=na * na
			lowerCamelCase__		:		Optional[Any]			=ra * x * na + ra * y * na
			return (n % m + m) % m


if __name__ == "__main__":
		from doctest import testmod

		testmod(name="chinese_remainder_theorem", verbose=True)
		testmod(name="chinese_remainder_theorem2", verbose=True)
		testmod(name="invert_modulo", verbose=True)
		testmod(name="extended_euclid", verbose=True)




