
import functools
import operator

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


UpperCAmelCase__		:     Tuple     			=      logging.get_logger(__name__)

UpperCAmelCase__		:     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 UpperCAmelCase   (						SCREAMING_SNAKE_CASE__   ):





   '''simple docstring'''
   __UpperCamelCase		:    int 				=    '''sew'''


   def __init__(					self     :							Optional[int]			,			lowerCAmelCase_     :							Optional[Any]=3_2			,			lowerCAmelCase_     :							int=7_6_8			,			lowerCAmelCase_     :							Tuple=1_2			,			lowerCAmelCase_     :							List[str]=1_2			,			lowerCAmelCase_     :							Optional[Any]=3_0_7_2			,			lowerCAmelCase_     :							Optional[int]=2			,			lowerCAmelCase_     :							str="gelu"			,			lowerCAmelCase_     :							str=0.1			,			lowerCAmelCase_     :							List[Any]=0.1			,			lowerCAmelCase_     :							Optional[Any]=0.1			,			lowerCAmelCase_     :							Optional[int]=0.0			,			lowerCAmelCase_     :							Union[str, Any]=0.1			,			lowerCAmelCase_     :							Tuple=0.1			,			lowerCAmelCase_     :							List[str]=0.02			,			lowerCAmelCase_     :							Tuple=1e-5			,			lowerCAmelCase_     :							Tuple="group"			,			lowerCAmelCase_     :							Tuple="gelu"			,			lowerCAmelCase_     :							int=(6_4, 1_2_8, 1_2_8, 1_2_8, 1_2_8, 2_5_6, 2_5_6, 2_5_6, 2_5_6, 5_1_2, 5_1_2, 5_1_2, 5_1_2)			,			lowerCAmelCase_     :							str=(5, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1)			,			lowerCAmelCase_     :							Tuple=(1_0, 3, 1, 3, 1, 3, 1, 3, 1, 2, 1, 2, 1)			,			lowerCAmelCase_     :							int=False			,			lowerCAmelCase_     :							List[Any]=1_2_8			,			lowerCAmelCase_     :							Tuple=1_6			,			lowerCAmelCase_     :							List[Any]=True			,			lowerCAmelCase_     :							Optional[int]=0.05			,			lowerCAmelCase_     :							Tuple=1_0			,			lowerCAmelCase_     :							Optional[Any]=2			,			lowerCAmelCase_     :							Union[str, Any]=0.0			,			lowerCAmelCase_     :							Union[str, Any]=1_0			,			lowerCAmelCase_     :							List[Any]=0			,			lowerCAmelCase_     :							Union[str, Any]="mean"			,			lowerCAmelCase_     :							Optional[int]=False			,			lowerCAmelCase_     :							Tuple=False			,			lowerCAmelCase_     :							List[str]=2_5_6			,			lowerCAmelCase_     :							Optional[int]=0			,			lowerCAmelCase_     :							Optional[Any]=1			,			lowerCAmelCase_     :							List[str]=2			,			**lowerCAmelCase_     :							List[str]			,			):

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

      # ctc loss
      _A:  Union[str, Any]					=       ctc_loss_reduction
      _A:  Tuple					=       ctc_zero_infinity

      # sequence classification
      _A:  Optional[Any]					=       use_weighted_layer_sum
      _A:  Tuple					=       classifier_proj_size


   @property
   def  __magic_name__				(					self     :							Any     ):

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





def   lowerCamelCase__							(					a		,		a      )      ->   str:
   if a < 0 or b < 0:
      raise ValueError('''the value of both inputs must be positive'''      )

   _A:  Union[str, Any]					=       str(bin(a      )      )[2:]  # remove the leading "0b"
   _A:  Union[str, Any]					=       str(bin(a      )      )[2:]  # remove the leading "0b"

   _A:  Optional[int]					=       max(len(a      )		,		len(a      )      )

   return "0b" + "".join(
       str(int(char_a != char_b      )      )
       for char_a, char_b in zip(a_binary.zfill(a      )		,		b_binary.zfill(a      )      )      )


if __name__ == "__main__":
   import doctest

   doctest.testmod()



