






'''simple docstring'''
import functools
import operator

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


a_					=	logging.get_logger(__name__)

a_					=	{
    'facebook/wav2vec2-base-960h': 'https://huggingface.co/facebook/wav2vec2-base-960h/resolve/main/config.json',
    # See all Wav2Vec2 models at https://huggingface.co/models?filter=wav2vec2
}






class        __SCREAMING_SNAKE_CASE (     _a			):
 snake_case_												=							"""wav2vec2"""




 def __init__( self		:							Union[str, Any]   , __lowercase		:							Any=32   , __lowercase		:							str=7_68   , __lowercase		:							str=12   , __lowercase		:							int=12   , __lowercase		:							Union[str, Any]=30_72   , __lowercase		:							Optional[int]="gelu"   , __lowercase		:							Union[str, Any]=0.1   , __lowercase		:							Optional[Any]=0.1   , __lowercase		:							List[Any]=0.1   , __lowercase		:							Optional[Any]=0.0   , __lowercase		:							Optional[Any]=0.0   , __lowercase		:							List[str]=0.1   , __lowercase		:							int=0.1   , __lowercase		:							Union[str, Any]=0.02   , __lowercase		:							Union[str, Any]=1e-5   , __lowercase		:							int="group"   , __lowercase		:							Optional[Any]="gelu"   , __lowercase		:							List[Any]=(5_12, 5_12, 5_12, 5_12, 5_12, 5_12, 5_12)   , __lowercase		:							Tuple=(5, 2, 2, 2, 2, 2, 2)   , __lowercase		:							Tuple=(10, 3, 3, 3, 3, 2, 2)   , __lowercase		:							Optional[int]=False   , __lowercase		:							str=1_28   , __lowercase		:							List[str]=16   , __lowercase		:							Optional[Any]=False   , __lowercase		:							Any=True   , __lowercase		:							str=0.05   , __lowercase		:							Optional[int]=10   , __lowercase		:							Dict=2   , __lowercase		:							Tuple=0.0   , __lowercase		:							Union[str, Any]=10   , __lowercase		:							List[Any]=0   , __lowercase		:							int=3_20   , __lowercase		:							Any=2   , __lowercase		:							int=0.1   , __lowercase		:							Optional[Any]=1_00   , __lowercase		:							Optional[Any]=2_56   , __lowercase		:							Any=2_56   , __lowercase		:							Dict=0.1   , __lowercase		:							Optional[int]="sum"   , __lowercase		:							Optional[Any]=False   , __lowercase		:							str=False   , __lowercase		:							Optional[Any]=2_56   , __lowercase		:							Optional[int]=(5_12, 5_12, 5_12, 5_12, 15_00)   , __lowercase		:							List[Any]=(5, 3, 3, 1, 1)   , __lowercase		:							Dict=(1, 2, 3, 1, 1)   , __lowercase		:							List[Any]=5_12   , __lowercase		:							Optional[int]=0   , __lowercase		:							str=1   , __lowercase		:							Optional[int]=2   , __lowercase		:							Tuple=False   , __lowercase		:							Dict=3   , __lowercase		:							Any=2   , __lowercase		:							Optional[Any]=3   , __lowercase		:							List[str]=None   , __lowercase		:							List[Any]=None   , **__lowercase		:							Dict   , )		->  int:
       super().__init__(**snake_case_   , pad_token_id=snake_case_   , bos_token_id=snake_case_   , eos_token_id=snake_case_ )
       SCREAMING_SNAKE_CASE__       :			Dict													=hidden_size
       SCREAMING_SNAKE_CASE__       :			Any													=feat_extract_norm
       SCREAMING_SNAKE_CASE__       :			Dict													=feat_extract_activation
       SCREAMING_SNAKE_CASE__       :			Tuple													=list(snake_case_ )
       SCREAMING_SNAKE_CASE__       :			int													=list(snake_case_ )
       SCREAMING_SNAKE_CASE__       :			Optional[Any]													=list(snake_case_ )
       SCREAMING_SNAKE_CASE__       :			Dict													=conv_bias
       SCREAMING_SNAKE_CASE__       :			Dict													=num_conv_pos_embeddings
       SCREAMING_SNAKE_CASE__       :			List[str]													=num_conv_pos_embedding_groups
       SCREAMING_SNAKE_CASE__       :			List[str]													=len(self.conv_dim )
       SCREAMING_SNAKE_CASE__       :			Tuple													=num_hidden_layers
       SCREAMING_SNAKE_CASE__       :			str													=intermediate_size
       SCREAMING_SNAKE_CASE__       :			Optional[Any]													=hidden_act
       SCREAMING_SNAKE_CASE__       :			Tuple													=num_attention_heads
       SCREAMING_SNAKE_CASE__       :			int													=hidden_dropout
       SCREAMING_SNAKE_CASE__       :			List[Any]													=attention_dropout
       SCREAMING_SNAKE_CASE__       :			List[str]													=activation_dropout
       SCREAMING_SNAKE_CASE__       :			Tuple													=feat_proj_dropout
       SCREAMING_SNAKE_CASE__       :			int													=final_dropout
       SCREAMING_SNAKE_CASE__       :			Tuple													=layerdrop
       SCREAMING_SNAKE_CASE__       :			Optional[Any]													=layer_norm_eps
       SCREAMING_SNAKE_CASE__       :			Optional[Any]													=initializer_range
       SCREAMING_SNAKE_CASE__       :			Optional[Any]													=vocab_size
       SCREAMING_SNAKE_CASE__       :			List[Any]													=do_stable_layer_norm
       SCREAMING_SNAKE_CASE__       :			List[Any]													=use_weighted_layer_sum

       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)`, but is `len(config.conv_dim) ='''
                 F" {len(self.conv_dim )}`, `len(config.conv_stride) = {len(self.conv_stride )}`,"
                 F" `len(config.conv_kernel) = {len(self.conv_kernel )}`." )

       # fine-tuning config parameters for SpecAugment: https://arxiv.org/abs/1904.08779
       SCREAMING_SNAKE_CASE__       :			Dict													=apply_spec_augment
       SCREAMING_SNAKE_CASE__       :			str													=mask_time_prob
       SCREAMING_SNAKE_CASE__       :			Optional[Any]													=mask_time_length
       SCREAMING_SNAKE_CASE__       :			Tuple													=mask_time_min_masks
       SCREAMING_SNAKE_CASE__       :			Optional[int]													=mask_feature_prob
       SCREAMING_SNAKE_CASE__       :			str													=mask_feature_length
       SCREAMING_SNAKE_CASE__       :			Optional[int]													=mask_feature_min_masks

       # parameters for pretraining with codevector quantized representations
       SCREAMING_SNAKE_CASE__       :			List[Any]													=num_codevectors_per_group
       SCREAMING_SNAKE_CASE__       :			Tuple													=num_codevector_groups
       SCREAMING_SNAKE_CASE__       :			Union[str, Any]													=contrastive_logits_temperature
       SCREAMING_SNAKE_CASE__       :			Tuple													=feat_quantizer_dropout
       SCREAMING_SNAKE_CASE__       :			Any													=num_negatives
       SCREAMING_SNAKE_CASE__       :			Optional[int]													=codevector_dim
       SCREAMING_SNAKE_CASE__       :			Optional[Any]													=proj_codevector_dim
       SCREAMING_SNAKE_CASE__       :			Union[str, Any]													=diversity_loss_weight

       # ctc loss
       SCREAMING_SNAKE_CASE__       :			str													=ctc_loss_reduction
       SCREAMING_SNAKE_CASE__       :			List[str]													=ctc_zero_infinity

       # adapter
       SCREAMING_SNAKE_CASE__       :			List[Any]													=add_adapter
       SCREAMING_SNAKE_CASE__       :			Optional[int]													=adapter_kernel_size
       SCREAMING_SNAKE_CASE__       :			Any													=adapter_stride
       SCREAMING_SNAKE_CASE__       :			Optional[Any]													=num_adapter_layers
       SCREAMING_SNAKE_CASE__       :			Any													=output_hidden_size or hidden_size
       SCREAMING_SNAKE_CASE__       :			int													=adapter_attn_dim

       # SequenceClassification-specific parameter. Feel free to ignore for other classes.
       SCREAMING_SNAKE_CASE__       :			Any													=classifier_proj_size

       # XVector-specific parameters. Feel free to ignore for other classes.
       SCREAMING_SNAKE_CASE__       :			Union[str, Any]													=list(snake_case_ )
       SCREAMING_SNAKE_CASE__       :			List[Any]													=list(snake_case_ )
       SCREAMING_SNAKE_CASE__       :			Tuple													=list(snake_case_ )
       SCREAMING_SNAKE_CASE__       :			List[Any]													=xvector_output_dim




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







'''simple docstring'''
import math





def 	_a(					UpperCamelCase__			:  int							):




      '''simple docstring'''






      return math.sqrt(UpperCamelCase__							) * math.sqrt(UpperCamelCase__							) == num





def 	_a(					UpperCamelCase__			:  int							):




      '''simple docstring'''






      SCREAMING_SNAKE_CASE__       :			List[Any]													=0
      SCREAMING_SNAKE_CASE__       :			Any													=n
      while left <= right:
            SCREAMING_SNAKE_CASE__       :			str													=(left + right) // 2
            if mid**2 == n:
                  return True
            elif mid**2 > n:
                  SCREAMING_SNAKE_CASE__       :			Optional[Any]													=mid - 1
            else:
                  SCREAMING_SNAKE_CASE__       :			Tuple													=mid + 1
      return False


if __name__ == "__main__":
  import doctest

  doctest.testmod()