





import functools
import operator

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


UpperCAmelCase_           =	logging.get_logger(__name__)

UpperCAmelCase_           =	{
    "microsoft/wavlm-base": "https://huggingface.co/microsoft/wavlm-base/resolve/main/config.json",
    # See all WavLM models at https://huggingface.co/models?filter=wavlm
}




class 			__UpperCamelCase    (							A__    ):
     __A	:  Union[str, Any]							  =   """wavlm"""





     def __init__(     self				,							_UpperCamelCase=32				,							_UpperCamelCase=768				,							_UpperCamelCase=12				,							_UpperCamelCase=12				,							_UpperCamelCase=3072				,							_UpperCamelCase="gelu"				,							_UpperCamelCase=0.1				,							_UpperCamelCase=0.1				,							_UpperCamelCase=0.1				,							_UpperCamelCase=0.0				,							_UpperCamelCase=0.1				,							_UpperCamelCase=0.1				,							_UpperCamelCase=0.02				,							_UpperCamelCase=1e-5				,							_UpperCamelCase="group"				,							_UpperCamelCase="gelu"				,							_UpperCamelCase=(512, 512, 512, 512, 512, 512, 512)				,							_UpperCamelCase=(5, 2, 2, 2, 2, 2, 2)				,							_UpperCamelCase=(10, 3, 3, 3, 3, 2, 2)				,							_UpperCamelCase=False				,							_UpperCamelCase=128				,							_UpperCamelCase=16				,							_UpperCamelCase=320				,							_UpperCamelCase=800				,							_UpperCamelCase=False				,							_UpperCamelCase=True				,							_UpperCamelCase=0.05				,							_UpperCamelCase=10				,							_UpperCamelCase=2				,							_UpperCamelCase=0.0				,							_UpperCamelCase=10				,							_UpperCamelCase=320				,							_UpperCamelCase=2				,							_UpperCamelCase=0.1				,							_UpperCamelCase=100				,							_UpperCamelCase=256				,							_UpperCamelCase=256				,							_UpperCamelCase=0.1				,							_UpperCamelCase="mean"				,							_UpperCamelCase=False				,							_UpperCamelCase=False				,							_UpperCamelCase=256				,							_UpperCamelCase=(512, 512, 512, 512, 1500)				,							_UpperCamelCase=(5, 3, 3, 1, 1)				,							_UpperCamelCase=(1, 2, 3, 1, 1)				,							_UpperCamelCase=512				,							_UpperCamelCase=80				,							_UpperCamelCase=0				,							_UpperCamelCase=1				,							_UpperCamelCase=2				,							_UpperCamelCase=False				,							_UpperCamelCase=3				,							_UpperCamelCase=2				,							_UpperCamelCase=3				,							_UpperCamelCase=None				,							**_UpperCamelCase				,							):
        super().__init__(**_UpperCamelCase				,							pad_token_id=_UpperCamelCase				,							bos_token_id=_UpperCamelCase				,							eos_token_id=_UpperCamelCase					)
        _UpperCAmelCase           =   hidden_size
        _UpperCAmelCase           =   feat_extract_norm
        _UpperCAmelCase           =   feat_extract_activation
        _UpperCAmelCase           =   list(_UpperCamelCase					)
        _UpperCAmelCase           =   list(_UpperCamelCase					)
        _UpperCAmelCase           =   list(_UpperCamelCase					)
        _UpperCAmelCase           =   conv_bias
        _UpperCAmelCase           =   num_buckets
        _UpperCAmelCase           =   max_bucket_distance
        _UpperCAmelCase           =   num_conv_pos_embeddings
        _UpperCAmelCase           =   num_conv_pos_embedding_groups
        _UpperCAmelCase           =   len(self.conv_dim					)
        _UpperCAmelCase           =   num_hidden_layers
        _UpperCAmelCase           =   intermediate_size
        _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           =   num_ctc_classes
        _UpperCAmelCase           =   vocab_size
        _UpperCAmelCase           =   do_stable_layer_norm
        _UpperCAmelCase           =   use_weighted_layer_sum
        _UpperCAmelCase           =   classifier_proj_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)`, 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
        _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

        # parameters for pretraining with codevector quantized representations
        _UpperCAmelCase           =   num_codevectors_per_group
        _UpperCAmelCase           =   num_codevector_groups
        _UpperCAmelCase           =   contrastive_logits_temperature
        _UpperCAmelCase           =   num_negatives
        _UpperCAmelCase           =   codevector_dim
        _UpperCAmelCase           =   proj_codevector_dim
        _UpperCAmelCase           =   diversity_loss_weight

        # ctc loss
        _UpperCAmelCase           =   ctc_loss_reduction
        _UpperCAmelCase           =   ctc_zero_infinity

        # adapter
        _UpperCAmelCase           =   add_adapter
        _UpperCAmelCase           =   adapter_kernel_size
        _UpperCAmelCase           =   adapter_stride
        _UpperCAmelCase           =   num_adapter_layers
        _UpperCAmelCase           =   output_hidden_size or hidden_size

        # SequenceClassification-specific parameter. Feel free to ignore for other classes.
        _UpperCAmelCase           =   classifier_proj_size

        # XVector-specific parameters. Feel free to ignore for other classes.
        _UpperCAmelCase           =   list(_UpperCamelCase					)
        _UpperCAmelCase           =   list(_UpperCamelCase					)
        _UpperCAmelCase           =   list(_UpperCamelCase					)
        _UpperCAmelCase           =   xvector_output_dim





     @property
     def 		UpperCamelCase(     self					):
        return functools.reduce(operator.mul				,							self.conv_stride				,							1					)






def      A__       (    SCREAMING_SNAKE_CASE_   :      int						)  ->  bool:






   """simple docstring"""







   if not isinstance(SCREAMING_SNAKE_CASE_				,	SCREAMING_SNAKE_CASE_						):
      _UpperCAmelCase           =   F'''Input value of [number={number}] must be an integer'''
      raise TypeError(SCREAMING_SNAKE_CASE_						)
   if number < 0:
      return False
   _UpperCAmelCase           =   number * number
   while number > 0:
      if number % 10 != number_square % 10:
         return False
      number //= 10
      number_square //= 10
   return True


if __name__ == "__main__":
   import doctest

   doctest.testmod()