

import functools
import operator

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


__a  :List[Any]										=       logging.get_logger(__name__)

__a  :Tuple										=       {
    '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"""

      _lowerCamelCase    :       int							=    'sew'





      def __init__(					self				:							List[Any]		,       UpperCAmelCase				:							Union[str, Any]=32		,       UpperCAmelCase				:							Optional[int]=768		,       UpperCAmelCase				:							str=12		,       UpperCAmelCase				:							Optional[Any]=12		,       UpperCAmelCase				:							List[str]=3072		,       UpperCAmelCase				:							List[str]=2		,       UpperCAmelCase				:							List[Any]="gelu"		,       UpperCAmelCase				:							int=0.1		,       UpperCAmelCase				:							int=0.1		,       UpperCAmelCase				:							Any=0.1		,       UpperCAmelCase				:							Any=0.0		,       UpperCAmelCase				:							Tuple=0.1		,       UpperCAmelCase				:							int=0.1		,       UpperCAmelCase				:							Any=0.02		,       UpperCAmelCase				:							Optional[int]=1E-5		,       UpperCAmelCase				:							Dict="group"		,       UpperCAmelCase				:							Any="gelu"		,       UpperCAmelCase				:							int=(64, 128, 128, 128, 128, 256, 256, 256, 256, 512, 512, 512, 512)		,       UpperCAmelCase				:							str=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)		,       UpperCAmelCase				:							Union[str, Any]=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)		,       UpperCAmelCase				:							Optional[Any]=False		,       UpperCAmelCase				:							Union[str, Any]=128		,       UpperCAmelCase				:							List[str]=16		,       UpperCAmelCase				:							Any=True		,       UpperCAmelCase				:							Optional[int]=0.05		,       UpperCAmelCase				:							Optional[Any]=10		,       UpperCAmelCase				:							Any=2		,       UpperCAmelCase				:							List[Any]=0.0		,       UpperCAmelCase				:							int=10		,       UpperCAmelCase				:							List[Any]=0		,       UpperCAmelCase				:							List[Any]="mean"		,       UpperCAmelCase				:							Union[str, Any]=False		,       UpperCAmelCase				:							List[Any]=False		,       UpperCAmelCase				:							List[Any]=256		,       UpperCAmelCase				:							Optional[Any]=0		,       UpperCAmelCase				:							List[Any]=1		,       UpperCAmelCase				:							List[Any]=2		,       **UpperCAmelCase				:							Union[str, Any]		,       ):
            super().__init__(**_a		,       pad_token_id=_a		,       bos_token_id=_a		,       eos_token_id=_a     )
            A_		   =							hidden_size
            A_		   =							feat_extract_norm
            A_		   =							feat_extract_activation
            A_		   =							list(_a     )
            A_		   =							list(_a     )
            A_		   =							list(_a     )
            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 						__A     (					self				:							Any     ):
            return functools.reduce(operator.mul		,       self.conv_stride		,       1     )



"""simple docstring"""




import warnings

from ..trainer import Trainer
from ..utils import logging


lowercase_			     =  logging.get_logger(__name__)
class 					__lowerCAmelCase					(   __SCREAMING_SNAKE_CASE       ):


		'''simple docstring'''



		def __init__(  self							, _a=None							, **_a      ):
				warnings.warn(
				    '''`SageMakerTrainer` is deprecated and will be removed in v5 of Transformers. You can use `Trainer` '''
				    '''instead.'''							, _a							, )
				super().__init__(args=_a							, **_a      )






