import functools
import operator

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


_lowerCAmelCase       =		logging.get_logger(__name__)

_lowerCAmelCase       =		{
    "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     lowerCAmelCase_     (       __lowercase ):
							UpperCAmelCase				   =     "sew"







							def __init__(   self      :     List[str] ,			_A      :     Union[str, Any]=32 ,			_A      :     str=768 ,			_A      :     List[str]=12 ,			_A      :     List[str]=12 ,			_A      :     Optional[int]=3072 ,			_A      :     Optional[int]=2 ,			_A      :     str="gelu" ,			_A      :     Dict=0.1 ,			_A      :     List[Any]=0.1 ,			_A      :     Any=0.1 ,			_A      :     Dict=0.0 ,			_A      :     str=0.1 ,			_A      :     Optional[int]=0.1 ,			_A      :     Dict=0.02 ,			_A      :     Optional[int]=1e-5 ,			_A      :     Dict="group" ,			_A      :     Optional[Any]="gelu" ,			_A      :     str=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512) ,			_A      :     Union[str, Any]=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1) ,			_A      :     List[Any]=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1) ,			_A      :     Optional[int]=False ,			_A      :     str=128 ,			_A      :     Any=16 ,			_A      :     List[Any]=True ,			_A      :     Optional[int]=0.05 ,			_A      :     Tuple=10 ,			_A      :     List[str]=2 ,			_A      :     List[str]=0.0 ,			_A      :     Optional[int]=10 ,			_A      :     int=0 ,			_A      :     Optional[int]="mean" ,			_A      :     Dict=False ,			_A      :     List[Any]=False ,			_A      :     List[Any]=256 ,			_A      :     List[Any]=0 ,			_A      :     List[str]=1 ,			_A      :     List[str]=2 ,			**_A      :     int ,			):
												super().__init__(**_A ,			pad_token_id=_A ,			bos_token_id=_A ,			eos_token_id=_A		)
												_UpperCamelCase			     =     hidden_size
												_UpperCamelCase			     =     feat_extract_norm
												_UpperCamelCase			     =     feat_extract_activation
												_UpperCamelCase			     =     list(_A		)
												_UpperCamelCase			     =     list(_A		)
												_UpperCamelCase			     =     list(_A		)
												_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			     =     hidden_act
												_UpperCamelCase			     =     num_attention_heads
												_UpperCamelCase			     =     hidden_dropout
												_UpperCamelCase			     =     attention_dropout
												_UpperCamelCase			     =     activation_dropout
												_UpperCamelCase			     =     feat_proj_dropout
												_UpperCamelCase			     =     final_dropout
												_UpperCamelCase			     =     layerdrop
												_UpperCamelCase			     =     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  UpperCamelCase_						(   self      :     Union[str, Any]		):
												return functools.reduce(operator.mul ,			self.conv_stride ,			1		)

import inspect
import warnings
from typing import Any, Dict, Optional, Union

from packaging import version
def 					_snake_case	(  *__snake_case  ,     __snake_case = None  ,     __snake_case=True  ,     __snake_case=2						):
					from .. import __version__

					_UpperCamelCase			     =     take_from
					_UpperCamelCase			     =     ()
					if not isinstance(args[0]  ,     __snake_case						):
										_UpperCamelCase			     =     (args,)

					for attribute, version_name, message in args:
										if version.parse(version.parse(__snake_case						).base_version						) >= version.parse(__snake_case						):
															raise ValueError(
															    f"""The deprecation tuple {(attribute, version_name, message)} should be removed since diffusers'"""
															    f""" version {__version__} is >= {version_name}"""						)

										_UpperCamelCase			     =     None
										if isinstance(__snake_case  ,     __snake_case						) and attribute in deprecated_kwargs:
															values += (deprecated_kwargs.pop(__snake_case						),)
															_UpperCamelCase			     =     f"""The `{attribute}` argument is deprecated and will be removed in version {version_name}."""
										elif hasattr(__snake_case  ,     __snake_case						):
															values += (getattr(__snake_case  ,     __snake_case						),)
															_UpperCamelCase			     =     f"""The `{attribute}` attribute is deprecated and will be removed in version {version_name}."""
										elif deprecated_kwargs is None:
															_UpperCamelCase			     =     f"""`{attribute}` is deprecated and will be removed in version {version_name}."""

										if warning is not None:
															_UpperCamelCase			     =     warning + ''' ''' if standard_warn else ''''''
															warnings.warn(warning + message  ,     __snake_case  ,     stacklevel=__snake_case						)

					if isinstance(__snake_case  ,     __snake_case						) and len(__snake_case						) > 0:
										_UpperCamelCase			     =     inspect.getouterframes(inspect.currentframe()						)[1]
										_UpperCamelCase			     =     call_frame.filename
										_UpperCamelCase			     =     call_frame.lineno
										_UpperCamelCase			     =     call_frame.function
										_UpperCamelCase     ,    _UpperCamelCase			     =     next(iter(deprecated_kwargs.items()						)						)
										raise TypeError(f"""{function} in {filename} line {line_number-1} got an unexpected keyword argument `{key}`"""						)

					if len(__snake_case						) == 0:
										return
					elif len(__snake_case						) == 1:
										return values[0]
					return values
