



"""simple docstring"""






import functools
import operator

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


__snake_case							:     List[str]   =					logging.get_logger(__name__)

__snake_case							:     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     A__     (						__SCREAMING_SNAKE_CASE							):




 '''simple docstring'''





 SCREAMING_SNAKE_CASE					   =			'sew'

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

    """simple docstring"""

    super().__init__(**_SCREAMING_SNAKE_CASE ,    pad_token_id=_SCREAMING_SNAKE_CASE ,    bos_token_id=_SCREAMING_SNAKE_CASE ,    eos_token_id=_SCREAMING_SNAKE_CASE)
    __lowerCAmelCase   :						List[str]				= hidden_size
    __lowerCAmelCase   :						List[Any]				= feat_extract_norm
    __lowerCAmelCase   :						List[str]				= feat_extract_activation
    __lowerCAmelCase   :						Optional[int]				= list(_SCREAMING_SNAKE_CASE)
    __lowerCAmelCase   :						Optional[Any]				= list(_SCREAMING_SNAKE_CASE)
    __lowerCAmelCase   :						List[Any]				= list(_SCREAMING_SNAKE_CASE)
    __lowerCAmelCase   :						str				= conv_bias
    __lowerCAmelCase   :						Dict				= num_conv_pos_embeddings
    __lowerCAmelCase   :						int				= num_conv_pos_embedding_groups
    __lowerCAmelCase   :						Union[str, Any]				= len(self.conv_dim)
    __lowerCAmelCase   :						int				= num_hidden_layers
    __lowerCAmelCase   :						List[Any]				= intermediate_size
    __lowerCAmelCase   :						Union[str, Any]				= squeeze_factor
    __lowerCAmelCase   :						List[str]				= hidden_act
    __lowerCAmelCase   :						Dict				= num_attention_heads
    __lowerCAmelCase   :						str				= hidden_dropout
    __lowerCAmelCase   :						List[Any]				= attention_dropout
    __lowerCAmelCase   :						Union[str, Any]				= activation_dropout
    __lowerCAmelCase   :						Tuple				= feat_proj_dropout
    __lowerCAmelCase   :						str				= final_dropout
    __lowerCAmelCase   :						Union[str, Any]				= layerdrop
    __lowerCAmelCase   :						List[Any]				= layer_norm_eps
    __lowerCAmelCase   :						str				= initializer_range
    __lowerCAmelCase   :						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
    __lowerCAmelCase   :						List[str]				= apply_spec_augment
    __lowerCAmelCase   :						str				= mask_time_prob
    __lowerCAmelCase   :						int				= mask_time_length
    __lowerCAmelCase   :						Optional[Any]				= mask_time_min_masks
    __lowerCAmelCase   :						List[Any]				= mask_feature_prob
    __lowerCAmelCase   :						Union[str, Any]				= mask_feature_length
    __lowerCAmelCase   :						List[Any]				= mask_feature_min_masks

    # ctc loss
    __lowerCAmelCase   :						str				= ctc_loss_reduction
    __lowerCAmelCase   :						Optional[Any]				= ctc_zero_infinity

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







 @property
 def 							_SCREAMING_SNAKE_CASE     (  self:	List[Any])       -> int:

    """simple docstring"""

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




"""simple docstring"""






from ..utils import DummyObject, requires_backends



class     A__     (						metaclass=__SCREAMING_SNAKE_CASE							):




	'''simple docstring'''





	SCREAMING_SNAKE_CASE					   =			['torch', 'scipy']

	def __init__(  self:	Tuple ,    *_SCREAMING_SNAKE_CASE:	Dict ,    **_SCREAMING_SNAKE_CASE:	str)       -> Union[str, Any]:

				"""simple docstring"""

				requires_backends(self ,    ["torch", "scipy"])

	@classmethod
	def 							_SCREAMING_SNAKE_CASE     (  cls:	Optional[Any] ,    *_SCREAMING_SNAKE_CASE:	Tuple ,    **_SCREAMING_SNAKE_CASE:	Optional[Any])       -> Optional[Any]:

				"""simple docstring"""

				requires_backends(cls ,    ["torch", "scipy"])







	@classmethod
	def 							_SCREAMING_SNAKE_CASE     (  cls:	int ,    *_SCREAMING_SNAKE_CASE:	List[Any] ,    **_SCREAMING_SNAKE_CASE:	Dict)       -> Union[str, Any]:

				"""simple docstring"""

				requires_backends(cls ,    ["torch", "scipy"])