


"""simple docstring"""



import math

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


__snake_case             =   logging.get_logger(__name__)

__snake_case             =   {
    """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 _lowerCAmelCase    (				snake_case_     ):
   __UpperCAmelCase			:	Optional[Any]							  =  '''data2vec-audio'''







   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__="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__=16						,     UpperCamelCase__=19						,     UpperCamelCase__=5						,     UpperCamelCase__=0.05						,     UpperCamelCase__=10						,     UpperCamelCase__=2						,     UpperCamelCase__=0.0						,     UpperCamelCase__=10						,     UpperCamelCase__=0						,     UpperCamelCase__="sum"						,     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__=0						,     UpperCamelCase__=1						,     UpperCamelCase__=2						,     UpperCamelCase__=False						,     UpperCamelCase__=3						,     UpperCamelCase__=2						,     UpperCamelCase__=3						,     UpperCamelCase__=None						,     **UpperCamelCase__						,     )     ->		Union[str, Any]:

       '''simple docstring'''




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

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

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

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

       # XVector-specific parameters. Feel free to ignore for other classes.
       snake_case   :				str				 =   list(UpperCamelCase__						)
       snake_case   :				str				 =   list(UpperCamelCase__						)
       snake_case   :				Tuple				 =   list(UpperCamelCase__						)
       snake_case   :				Optional[Any]				 =   xvector_output_dim







   @property
   def 			lowerCamelCase		(     self						)     ->		str:

       '''simple docstring'''




       return math.prod(self.conv_stride						)









"""simple docstring"""



import doctest
import logging
import os
import unittest
from pathlib import Path
from typing import List, Union

import transformers
from transformers.testing_utils import require_tf, require_torch, slow


__snake_case             =   logging.getLogger()







@unittest.skip('''Temporarily disable the doc tests.'''     )
@require_torch
@require_tf
@slow
class _lowerCAmelCase    (				unittest.TestCase     ):







   def 			lowerCamelCase		(     self						,     UpperCamelCase__						,     UpperCamelCase__ = None						,     UpperCamelCase__ = None						,     UpperCamelCase__ = None						,     UpperCamelCase__ = True						,     )     ->		Tuple:

       '''simple docstring'''




       snake_case   :				List[Any]				 =   [file for file in os.listdir(UpperCamelCase__						) if os.path.isfile(os.path.join(UpperCamelCase__						,     UpperCamelCase__						)						)]

       if identifier is not None:
           snake_case   :				Optional[Any]				 =   [file for file in files if identifier in file]

       if n_identifier is not None:
           if isinstance(UpperCamelCase__						,     UpperCamelCase__						):
               for n_ in n_identifier:
                   snake_case   :				str				 =   [file for file in files if n_ not in file]
           else:
               snake_case   :				str				 =   [file for file in files if n_identifier not in file]

       snake_case   :				Tuple				 =   ignore_files or []
       ignore_files.append("__init__.py"						)
       snake_case   :				Optional[Any]				 =   [file for file in files if file not in ignore_files]

       for file in files:
           # Open all files
           print("Testing"						,     UpperCamelCase__						)

           if only_modules:
               snake_case   :				str				 =   file.split("."						)[0]
               try:
                   snake_case   :				Optional[int]				 =   getattr(UpperCamelCase__						,     UpperCamelCase__						)
                   snake_case   :				str				 =   doctest.DocTestSuite(UpperCamelCase__						)
                   snake_case   :				Optional[Any]				 =   unittest.TextTestRunner().run(UpperCamelCase__						)
                   self.assertIs(len(result.failures						)						,     0						)
               except AttributeError:
                   logger.info(F'{module_identifier} is not a module.'						)
           else:
               snake_case   :				Tuple				 =   doctest.testfile(str(".." / directory / file						)						,     optionflags=doctest.ELLIPSIS						)
               self.assertIs(result.failed						,     0						)







   def 			lowerCamelCase		(     self						)     ->		str:

       '''simple docstring'''




       snake_case   :				Tuple				 =   Path("src/transformers"						)
       snake_case   :				List[Any]				 =   "modeling"
       snake_case   :				Dict				 =   [
           "modeling_ctrl.py",
           "modeling_tf_ctrl.py",
       ]
       self.analyze_directory(UpperCamelCase__						,     identifier=UpperCamelCase__						,     ignore_files=UpperCamelCase__						)







   def 			lowerCamelCase		(     self						)     ->		Dict:

       '''simple docstring'''




       snake_case   :				Optional[Any]				 =   Path("src/transformers"						)
       snake_case   :				Optional[Any]				 =   "tokenization"
       self.analyze_directory(UpperCamelCase__						,     identifier=UpperCamelCase__						)







   def 			lowerCamelCase		(     self						)     ->		List[str]:

       '''simple docstring'''




       snake_case   :				Union[str, Any]				 =   Path("src/transformers"						)
       snake_case   :				Optional[Any]				 =   "configuration"
       self.analyze_directory(UpperCamelCase__						,     identifier=UpperCamelCase__						)







   def 			lowerCamelCase		(     self						)     ->		Optional[Any]:

       '''simple docstring'''




       snake_case   :				List[str]				 =   Path("src/transformers"						)
       snake_case   :				List[str]				 =   ["configuration", "modeling", "tokenization"]
       self.analyze_directory(UpperCamelCase__						,     n_identifier=UpperCamelCase__						)







   def 			lowerCamelCase		(     self						)     ->		List[Any]:

       '''simple docstring'''




       snake_case   :				Any				 =   Path("docs/source"						)
       snake_case   :				Tuple				 =   ["favicon.ico"]
       self.analyze_directory(UpperCamelCase__						,     ignore_files=UpperCamelCase__						,     only_modules=UpperCamelCase__						)





