
"""simple docstring"""

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


_A						=			logging.get_logger(__name__)

_A						=			{
    'speechbrain/m-ctc-t-large': 'https://huggingface.co/speechbrain/m-ctc-t-large/resolve/main/config.json',
    # See all M-CTC-T models at https://huggingface.co/models?filter=mctct
}






class 	_lowercase       (    __UpperCAmelCase		):
	lowercase_				=     'mctct'




	def __init__(			self		,			UpperCAmelCase_=8065		,			UpperCAmelCase_=1536		,			UpperCAmelCase_=36		,			UpperCAmelCase_=6144		,			UpperCAmelCase_=4		,			UpperCAmelCase_=384		,			UpperCAmelCase_=920		,			UpperCAmelCase_=1E-5		,			UpperCAmelCase_=0.3		,			UpperCAmelCase_="relu"		,			UpperCAmelCase_=0.02		,			UpperCAmelCase_=0.3		,			UpperCAmelCase_=0.3		,			UpperCAmelCase_=1		,			UpperCAmelCase_=0		,			UpperCAmelCase_=2		,			UpperCAmelCase_=1		,			UpperCAmelCase_=0.3		,			UpperCAmelCase_=1		,			UpperCAmelCase_=(7,)		,			UpperCAmelCase_=(3,)		,			UpperCAmelCase_=80		,			UpperCAmelCase_=1		,			UpperCAmelCase_=None		,			UpperCAmelCase_="sum"		,			UpperCAmelCase_=False		,			**UpperCAmelCase_		,			)		->							int:
			super().__init__(**UpperCAmelCase_		,			pad_token_id=UpperCAmelCase_		,			bos_token_id=UpperCAmelCase_		,			eos_token_id=UpperCAmelCase_ )
			lowerCamelCase					:      str          =   vocab_size
			lowerCamelCase					:      List[Any]          =   hidden_size
			lowerCamelCase					:      Dict          =   num_hidden_layers
			lowerCamelCase					:      Optional[int]          =   intermediate_size
			lowerCamelCase					:      Tuple          =   num_attention_heads
			lowerCamelCase					:      Dict          =   attention_head_dim
			lowerCamelCase					:      str          =   max_position_embeddings
			lowerCamelCase					:      Optional[int]          =   layer_norm_eps
			lowerCamelCase					:      Dict          =   layerdrop
			lowerCamelCase					:      Any          =   hidden_act
			lowerCamelCase					:      List[Any]          =   initializer_range
			lowerCamelCase					:      List[Any]          =   hidden_dropout_prob
			lowerCamelCase					:      Any          =   attention_probs_dropout_prob
			lowerCamelCase					:      Any          =   pad_token_id
			lowerCamelCase					:      List[Any]          =   bos_token_id
			lowerCamelCase					:      Dict          =   eos_token_id
			lowerCamelCase					:      Any          =   conv_glu_dim
			lowerCamelCase					:      str          =   conv_dropout
			lowerCamelCase					:      Union[str, Any]          =   num_conv_layers
			lowerCamelCase					:      Tuple          =   input_feat_per_channel
			lowerCamelCase					:      List[str]          =   input_channels
			lowerCamelCase					:      str          =   conv_channels
			lowerCamelCase					:      Any          =   ctc_loss_reduction
			lowerCamelCase					:      Optional[Any]          =   ctc_zero_infinity

			# prevents config testing fail with exporting to json
			lowerCamelCase					:      int          =   list(UpperCAmelCase_ )
			lowerCamelCase					:      str          =   list(UpperCAmelCase_ )

			if len(self.conv_kernel ) != self.num_conv_layers:
					raise ValueError(
					    'Configuration for convolutional module is incorrect. '
					    'It is required that `len(config.conv_kernel)` == `config.num_conv_layers` '
					    F"""but is `len(config.conv_kernel) = {len(self.conv_kernel )}`, """
					    F"""`config.num_conv_layers = {self.num_conv_layers}`.""" )








"""simple docstring"""

import functools
import operator

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


_A						=			logging.get_logger(__name__)

_A						=			{
    '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 	_lowercase       (    __UpperCAmelCase		):
	lowercase_				=     'sew-d'




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

			# ctc loss
			lowerCamelCase					:      Optional[Any]          =   ctc_loss_reduction
			lowerCamelCase					:      Union[str, Any]          =   ctc_zero_infinity

			# sequence classification
			lowerCamelCase					:      Optional[Any]          =   use_weighted_layer_sum
			lowerCamelCase					:      Dict          =   classifier_proj_size




	@property
	def       _UpperCamelCase   (			self )		->							Optional[Any]:
			return functools.reduce(operator.mul		,			self.conv_stride		,			1 )






