






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 						lowercase_   (      UpperCAmelCase__  ):






      '''simple docstring'''




      __snake_case	    =    '''sew'''







      def __init__( self :		List[Any]					,   __UpperCAmelCase :		Union[str, Any]=32					,   __UpperCAmelCase :		List[Any]=768					,   __UpperCAmelCase :		List[Any]=12					,   __UpperCAmelCase :		Dict=12					,   __UpperCAmelCase :		List[str]=3_072					,   __UpperCAmelCase :		List[str]=2					,   __UpperCAmelCase :		Union[str, Any]="gelu"					,   __UpperCAmelCase :		Dict=0.1					,   __UpperCAmelCase :		Dict=0.1					,   __UpperCAmelCase :		str=0.1					,   __UpperCAmelCase :		str=0.0					,   __UpperCAmelCase :		Union[str, Any]=0.1					,   __UpperCAmelCase :		List[Any]=0.1					,   __UpperCAmelCase :		Dict=0.02					,   __UpperCAmelCase :		Any=1e-5					,   __UpperCAmelCase :		Optional[int]="group"					,   __UpperCAmelCase :		Optional[Any]="gelu"					,   __UpperCAmelCase :		Dict=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)					,   __UpperCAmelCase :		Tuple=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)					,   __UpperCAmelCase :		int=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)					,   __UpperCAmelCase :		List[Any]=False					,   __UpperCAmelCase :		Tuple=128					,   __UpperCAmelCase :		Union[str, Any]=16					,   __UpperCAmelCase :		List[str]=True					,   __UpperCAmelCase :		int=0.05					,   __UpperCAmelCase :		Any=10					,   __UpperCAmelCase :		Tuple=2					,   __UpperCAmelCase :		Optional[Any]=0.0					,   __UpperCAmelCase :		str=10					,   __UpperCAmelCase :		Tuple=0					,   __UpperCAmelCase :		str="mean"					,   __UpperCAmelCase :		Optional[Any]=False					,   __UpperCAmelCase :		Any=False					,   __UpperCAmelCase :		Optional[int]=256					,   __UpperCAmelCase :		List[str]=0					,   __UpperCAmelCase :		Any=1					,   __UpperCAmelCase :		List[Any]=2					,   **__UpperCAmelCase :		Any					,   )       ->Any:




       """simple docstring"""


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

       # ctc loss
       a						    = ctc_loss_reduction
       a						    = ctc_zero_infinity

       # sequence classification
       a						    = use_weighted_layer_sum
       a						    = classifier_proj_size







      @property
      def  __lowerCAmelCase   ( self :		List[Any]    )       ->List[str]:




       """simple docstring"""


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








from abc import ABC, abstractmethod
from argparse import ArgumentParser
class 						UpperCAmelCase  (							UpperCAmelCase__     ):







						'''simple docstring'''





						@staticmethod
						@abstractmethod
						def 			snake_case__		(		__lowercase				:	ArgumentParser		):






							"""simple docstring"""






							raise NotImplementedError()






						@abstractmethod
						def 			snake_case__		(		self				:	Optional[Any]		):






							"""simple docstring"""






							raise NotImplementedError()
