
'''simple docstring'''



import functools
import operator

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


UpperCamelCase__      :		Dict       							=  logging.get_logger(__name__)

UpperCamelCase__      :		List[str]       							=  {
    "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				(_lowerCamelCase):





       """simple docstring"""




       SCREAMING_SNAKE_CASE      =  'sew'






       def __init__(							self       ,							A__=32       ,							A__=7_68       ,							A__=12       ,							A__=12       ,							A__=30_72       ,							A__=2       ,							A__="gelu"       ,							A__=0.1       ,							A__=0.1       ,							A__=0.1       ,							A__=0.0       ,							A__=0.1       ,							A__=0.1       ,							A__=0.02       ,							A__=1E-5       ,							A__="group"       ,							A__="gelu"       ,							A__=(64, 1_28, 1_28, 1_28, 1_28, 2_56, 2_56, 2_56, 2_56, 5_12, 5_12, 5_12, 5_12)       ,							A__=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)       ,							A__=(10, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)       ,							A__=False       ,							A__=1_28       ,							A__=16       ,							A__=True       ,							A__=0.05       ,							A__=10       ,							A__=2       ,							A__=0.0       ,							A__=10       ,							A__=0       ,							A__="mean"       ,							A__=False       ,							A__=False       ,							A__=2_56       ,							A__=0       ,							A__=1       ,							A__=2       ,							**A__       ,							)    ->			List[Any]:
          super().__init__(**A__       ,							pad_token_id=A__       ,							bos_token_id=A__       ,							eos_token_id=A__      )
          _SCREAMING_SNAKE_CASE      =				hidden_size
          _SCREAMING_SNAKE_CASE      =				feat_extract_norm
          _SCREAMING_SNAKE_CASE      =				feat_extract_activation
          _SCREAMING_SNAKE_CASE      =				list(A__      )
          _SCREAMING_SNAKE_CASE      =				list(A__      )
          _SCREAMING_SNAKE_CASE      =				list(A__      )
          _SCREAMING_SNAKE_CASE      =				conv_bias
          _SCREAMING_SNAKE_CASE      =				num_conv_pos_embeddings
          _SCREAMING_SNAKE_CASE      =				num_conv_pos_embedding_groups
          _SCREAMING_SNAKE_CASE      =				len(self.conv_dim      )
          _SCREAMING_SNAKE_CASE      =				num_hidden_layers
          _SCREAMING_SNAKE_CASE      =				intermediate_size
          _SCREAMING_SNAKE_CASE      =				squeeze_factor
          _SCREAMING_SNAKE_CASE      =				hidden_act
          _SCREAMING_SNAKE_CASE      =				num_attention_heads
          _SCREAMING_SNAKE_CASE      =				hidden_dropout
          _SCREAMING_SNAKE_CASE      =				attention_dropout
          _SCREAMING_SNAKE_CASE      =				activation_dropout
          _SCREAMING_SNAKE_CASE      =				feat_proj_dropout
          _SCREAMING_SNAKE_CASE      =				final_dropout
          _SCREAMING_SNAKE_CASE      =				layerdrop
          _SCREAMING_SNAKE_CASE      =				layer_norm_eps
          _SCREAMING_SNAKE_CASE      =				initializer_range
          _SCREAMING_SNAKE_CASE      =				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
          _SCREAMING_SNAKE_CASE      =				apply_spec_augment
          _SCREAMING_SNAKE_CASE      =				mask_time_prob
          _SCREAMING_SNAKE_CASE      =				mask_time_length
          _SCREAMING_SNAKE_CASE      =				mask_time_min_masks
          _SCREAMING_SNAKE_CASE      =				mask_feature_prob
          _SCREAMING_SNAKE_CASE      =				mask_feature_length
          _SCREAMING_SNAKE_CASE      =				mask_feature_min_masks

          # ctc loss
          _SCREAMING_SNAKE_CASE      =				ctc_loss_reduction
          _SCREAMING_SNAKE_CASE      =				ctc_zero_infinity

          # sequence classification
          _SCREAMING_SNAKE_CASE      =				use_weighted_layer_sum
          _SCREAMING_SNAKE_CASE      =				classifier_proj_size






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








'''simple docstring'''



def    lowerCAmelCase_	(				SCREAMING_SNAKE_CASE_						)     ->     int:




   """simple docstring"""

   if not isinstance(SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_						):
      raise ValueError("""multiplicative_persistence() only accepts integral values"""						)
   if num < 0:
      raise ValueError("""multiplicative_persistence() does not accept negative values"""						)

   _SCREAMING_SNAKE_CASE      =				0
   _SCREAMING_SNAKE_CASE      =				str(SCREAMING_SNAKE_CASE_						)

   while len(SCREAMING_SNAKE_CASE_						) != 1:
      _SCREAMING_SNAKE_CASE      =				[int(SCREAMING_SNAKE_CASE_						) for i in num_string]

      _SCREAMING_SNAKE_CASE      =				1
      for i in range(0    ,      len(SCREAMING_SNAKE_CASE_						)						):
         total *= numbers[i]

      _SCREAMING_SNAKE_CASE      =				str(SCREAMING_SNAKE_CASE_						)

      steps += 1
   return steps
def    lowerCAmelCase_	(				SCREAMING_SNAKE_CASE_						)     ->     int:




   """simple docstring"""

   if not isinstance(SCREAMING_SNAKE_CASE_    ,      SCREAMING_SNAKE_CASE_						):
      raise ValueError("""additive_persistence() only accepts integral values"""						)
   if num < 0:
      raise ValueError("""additive_persistence() does not accept negative values"""						)

   _SCREAMING_SNAKE_CASE      =				0
   _SCREAMING_SNAKE_CASE      =				str(SCREAMING_SNAKE_CASE_						)

   while len(SCREAMING_SNAKE_CASE_						) != 1:
      _SCREAMING_SNAKE_CASE      =				[int(SCREAMING_SNAKE_CASE_						) for i in num_string]

      _SCREAMING_SNAKE_CASE      =				0
      for i in range(0    ,      len(SCREAMING_SNAKE_CASE_						)						):
         total += numbers[i]

      _SCREAMING_SNAKE_CASE      =				str(SCREAMING_SNAKE_CASE_						)

      steps += 1
   return steps


if __name__ == "__main__":
     import doctest

     doctest.testmod()






