




import functools
import operator

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


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

__A						:							Dict							=  {
    """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 			UpperCAmelCase_      (   A       ):




							'''simple docstring'''



							a__						  =     '''sew'''





							def __init__(					self       :	str       ,     a       :	int=32       ,     a       :	List[str]=768       ,     a       :	Dict=12       ,     a       :	int=12       ,     a       :	Dict=3_072       ,     a       :	Any=2       ,     a       :	Tuple="gelu"       ,     a       :	List[str]=0.1       ,     a       :	Any=0.1       ,     a       :	Union[str, Any]=0.1       ,     a       :	Optional[Any]=0.0       ,     a       :	Union[str, Any]=0.1       ,     a       :	Optional[int]=0.1       ,     a       :	Any=0.02       ,     a       :	Any=1E-5       ,     a       :	List[str]="group"       ,     a       :	Union[str, Any]="gelu"       ,     a       :	Optional[int]=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)       ,     a       :	Any=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)       ,     a       :	Optional[Any]=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)       ,     a       :	Tuple=False       ,     a       :	Optional[Any]=128       ,     a       :	List[str]=16       ,     a       :	Optional[Any]=True       ,     a       :	Tuple=0.05       ,     a       :	List[str]=10       ,     a       :	List[Any]=2       ,     a       :	Union[str, Any]=0.0       ,     a       :	Union[str, Any]=10       ,     a       :	Any=0       ,     a       :	int="mean"       ,     a       :	Any=False       ,     a       :	Optional[int]=False       ,     a       :	Optional[Any]=256       ,     a       :	Union[str, Any]=0       ,     a       :	Dict=1       ,     a       :	Any=2       ,     **a       :	Union[str, Any]       ,     )			->					Optional[int]:
										super().__init__(**a       ,     pad_token_id=a       ,     bos_token_id=a       ,     eos_token_id=a			)
										SCREAMING_SNAKE_CASE           =					hidden_size
										SCREAMING_SNAKE_CASE           =					feat_extract_norm
										SCREAMING_SNAKE_CASE           =					feat_extract_activation
										SCREAMING_SNAKE_CASE           =					list(a			)
										SCREAMING_SNAKE_CASE           =					list(a			)
										SCREAMING_SNAKE_CASE           =					list(a			)
										SCREAMING_SNAKE_CASE           =					conv_bias
										SCREAMING_SNAKE_CASE           =					num_conv_pos_embeddings
										SCREAMING_SNAKE_CASE           =					num_conv_pos_embedding_groups
										SCREAMING_SNAKE_CASE           =					len(self.conv_dim			)
										SCREAMING_SNAKE_CASE           =					num_hidden_layers
										SCREAMING_SNAKE_CASE           =					intermediate_size
										SCREAMING_SNAKE_CASE           =					squeeze_factor
										SCREAMING_SNAKE_CASE           =					hidden_act
										SCREAMING_SNAKE_CASE           =					num_attention_heads
										SCREAMING_SNAKE_CASE           =					hidden_dropout
										SCREAMING_SNAKE_CASE           =					attention_dropout
										SCREAMING_SNAKE_CASE           =					activation_dropout
										SCREAMING_SNAKE_CASE           =					feat_proj_dropout
										SCREAMING_SNAKE_CASE           =					final_dropout
										SCREAMING_SNAKE_CASE           =					layerdrop
										SCREAMING_SNAKE_CASE           =					layer_norm_eps
										SCREAMING_SNAKE_CASE           =					initializer_range
										SCREAMING_SNAKE_CASE           =					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
										SCREAMING_SNAKE_CASE           =					apply_spec_augment
										SCREAMING_SNAKE_CASE           =					mask_time_prob
										SCREAMING_SNAKE_CASE           =					mask_time_length
										SCREAMING_SNAKE_CASE           =					mask_time_min_masks
										SCREAMING_SNAKE_CASE           =					mask_feature_prob
										SCREAMING_SNAKE_CASE           =					mask_feature_length
										SCREAMING_SNAKE_CASE           =					mask_feature_min_masks

										# ctc loss
										SCREAMING_SNAKE_CASE           =					ctc_loss_reduction
										SCREAMING_SNAKE_CASE           =					ctc_zero_infinity

										# sequence classification
										SCREAMING_SNAKE_CASE           =					use_weighted_layer_sum
										SCREAMING_SNAKE_CASE           =					classifier_proj_size







							@property
							def    _UpperCAmelCase     (					self       :	Dict			)			->					Union[str, Any]:
										return functools.reduce(operator.mul       ,     self.conv_stride       ,     1			)












from __future__ import annotations

import typing
from collections.abc import Iterable

import numpy as np

__A						:							Dict							=  typing.Union[Iterable[float], Iterable[int], np.ndarray]  # noqa: UP007
__A						:							Tuple							=  typing.Union[np.floataa, int, float]  # noqa: UP007
def 					lowerCamelCase_    (    SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   ):
			'''simple docstring'''
			return np.sqrt(np.sum((np.asarray(SCREAMING_SNAKE_CASE   ) - np.asarray(SCREAMING_SNAKE_CASE   )) ** 2   )   )
def 					lowerCamelCase_    (    SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   ):
			'''simple docstring'''
			return sum((va - va) ** 2 for va, va in zip(SCREAMING_SNAKE_CASE					,	SCREAMING_SNAKE_CASE   )   ) ** (1 / 2)


if __name__ == "__main__":
		def 					lowerCamelCase_    (    ):
					'''simple docstring'''
					from timeit import timeit

					print("""Without Numpy"""   )
					print(
					    timeit(
					        """euclidean_distance_no_np([1, 2, 3], [4, 5, 6])"""					,	number=1_00_00					,	globals=globals()					,	)   )
					print("""With Numpy"""   )
					print(
					    timeit(
					        """euclidean_distance([1, 2, 3], [4, 5, 6])"""					,	number=1_00_00					,	globals=globals()					,	)   )




		benchmark()






