






"""simple docstring"""



import functools
import operator

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


A__			:							Tuple					   =   logging.get_logger(__name__)

A__			:							Optional[Any]					   =   {
    '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__     (				SCREAMING_SNAKE_CASE_  ):
			_UpperCAmelCase						:List[Any]       =					"sew"


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

										# ctc loss
										lowerCamelCase_			:				List[Any]										=ctc_loss_reduction
										lowerCamelCase_			:				List[str]										=ctc_zero_infinity

										# sequence classification
										lowerCamelCase_			:				Union[str, Any]										=use_weighted_layer_sum
										lowerCamelCase_			:				int										=classifier_proj_size


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





"""simple docstring"""

import functools
import operator

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


SCREAMING_SNAKE_CASE_            =    logging.get_logger(__name__)

SCREAMING_SNAKE_CASE_            =    {
    '''asapp/sew-d-tiny-100k''': '''https://huggingface.co/asapp/sew-d-tiny-100k/resolve/main/config.json''',
    # See all SEW-D models at https://huggingface.co/models?filter=sew-d
}
class   _UpperCAmelCase				(		SCREAMING_SNAKE_CASE_				):
      __SCREAMING_SNAKE_CASE :				List[str]				   =						"sew-d"




      def __init__(				self ,							lowercase_=3_2 ,							lowercase_=7_6_8 ,							lowercase_=1_2 ,							lowercase_=1_2 ,							lowercase_=3_0_7_2 ,							lowercase_=2 ,							lowercase_=5_1_2 ,							lowercase_=2_5_6 ,							lowercase_=True ,							lowercase_=True ,							lowercase_=("p2c", "c2p") ,							lowercase_="layer_norm" ,							lowercase_="gelu_python" ,							lowercase_=0.1 ,							lowercase_=0.1 ,							lowercase_=0.1 ,							lowercase_=0.0 ,							lowercase_=0.1 ,							lowercase_=0.0_2 ,							lowercase_=1E-7 ,							lowercase_=1E-5 ,							lowercase_="group" ,							lowercase_="gelu" ,							lowercase_=(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) ,							lowercase_=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1) ,							lowercase_=(1_0, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1) ,							lowercase_=False ,							lowercase_=1_2_8 ,							lowercase_=1_6 ,							lowercase_=True ,							lowercase_=0.0_5 ,							lowercase_=1_0 ,							lowercase_=2 ,							lowercase_=0.0 ,							lowercase_=1_0 ,							lowercase_=0 ,							lowercase_="mean" ,							lowercase_=False ,							lowercase_=False ,							lowercase_=2_5_6 ,							lowercase_=0 ,							lowercase_=1 ,							lowercase_=2 ,							**lowercase_ ,							)    ->       Dict:
          super().__init__(**lowercase_ ,							pad_token_id=lowercase_ ,							bos_token_id=lowercase_ ,							eos_token_id=lowercase_				)
          UpperCAmelCase          =       hidden_size
          UpperCAmelCase          =       feat_extract_norm
          UpperCAmelCase          =       feat_extract_activation
          UpperCAmelCase          =       list(lowercase_				)
          UpperCAmelCase          =       list(lowercase_				)
          UpperCAmelCase          =       list(lowercase_				)
          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          =       squeeze_factor
          UpperCAmelCase          =       max_position_embeddings
          UpperCAmelCase          =       position_buckets
          UpperCAmelCase          =       share_att_key
          UpperCAmelCase          =       relative_attention
          UpperCAmelCase          =       norm_rel_ebd
          UpperCAmelCase          =       list(lowercase_				)
          UpperCAmelCase          =       hidden_act
          UpperCAmelCase          =       num_attention_heads
          UpperCAmelCase          =       hidden_dropout
          UpperCAmelCase          =       attention_dropout
          UpperCAmelCase          =       activation_dropout
          UpperCAmelCase          =       feat_proj_dropout
          UpperCAmelCase          =       final_dropout
          UpperCAmelCase          =       layer_norm_eps
          UpperCAmelCase          =       feature_layer_norm_eps
          UpperCAmelCase          =       initializer_range
          UpperCAmelCase          =       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          =       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

          # ctc loss
          UpperCAmelCase          =       ctc_loss_reduction
          UpperCAmelCase          =       ctc_zero_infinity

          # sequence classification
          UpperCAmelCase          =       use_weighted_layer_sum
          UpperCAmelCase          =       classifier_proj_size




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



