


import math

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


__lowerCamelCase         =			logging.get_logger(__name__)

__lowerCamelCase         =			{
    '''facebook/data2vec-base-960h''': '''https://huggingface.co/facebook/data2vec-audio-base-960h/resolve/main/config.json''',
    # See all Data2VecAudio models at https://huggingface.co/models?filter=data2vec-audio
}


class   snake_case_ (__lowerCamelCase  ):




       """simple docstring"""






       _lowerCamelCase			    =				"""data2vec-audio"""



       def __init__(     self     ,lowercase=32     ,lowercase=768     ,lowercase=12     ,lowercase=12     ,lowercase=3072     ,lowercase="gelu"     ,lowercase=0.1     ,lowercase=0.1     ,lowercase=0.1     ,lowercase=0.0     ,lowercase=0.1     ,lowercase=0.1     ,lowercase=0.02     ,lowercase=1E-5     ,lowercase="gelu"     ,lowercase=(512, 512, 512, 512, 512, 512, 512)     ,lowercase=(5, 2, 2, 2, 2, 2, 2)     ,lowercase=(10, 3, 3, 3, 3, 2, 2)     ,lowercase=False     ,lowercase=16     ,lowercase=19     ,lowercase=5     ,lowercase=0.05     ,lowercase=10     ,lowercase=2     ,lowercase=0.0     ,lowercase=10     ,lowercase=0     ,lowercase="sum"     ,lowercase=False     ,lowercase=False     ,lowercase=256     ,lowercase=(512, 512, 512, 512, 1500)     ,lowercase=(5, 3, 3, 1, 1)     ,lowercase=(1, 2, 3, 1, 1)     ,lowercase=512     ,lowercase=0     ,lowercase=1     ,lowercase=2     ,lowercase=False     ,lowercase=3     ,lowercase=2     ,lowercase=3     ,lowercase=None     ,**lowercase     ,):

             """simple docstring"""





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

             # ctc loss
             UpperCAmelCase_  :	Union[str, Any]				      =		ctc_loss_reduction
             UpperCAmelCase_  :	Dict				      =		ctc_zero_infinity

             # adapter
             UpperCAmelCase_  :	List[Any]				      =		add_adapter
             UpperCAmelCase_  :	str				      =		adapter_kernel_size
             UpperCAmelCase_  :	str				      =		adapter_stride
             UpperCAmelCase_  :	int				      =		num_adapter_layers
             UpperCAmelCase_  :	List[str]				      =		output_hidden_size or hidden_size

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

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



       @property
       def  A_   (     self):

             """simple docstring"""





             return math.prod(self.conv_stride)





def    _snake_case (       __snake_case					,  __snake_case    )     ->     str:






      '''simple docstring'''







      if a < 0 or b < 0:
            raise ValueError("the value of both inputs must be positive"    )

      UpperCAmelCase_  :	List[Any]				      =		str(bin(__snake_case    )    )[2:]  # remove the leading "0b"
      UpperCAmelCase_  :	int				      =		str(bin(__snake_case    )    )[2:]  # remove the leading "0b"

      UpperCAmelCase_  :	Optional[int]				      =		max(len(__snake_case    )					,  len(__snake_case    )    )

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


if __name__ == "__main__":
   import doctest

   doctest.testmod()
