

'''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


UpperCamelCase_    						=       logging.getLogger()





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







				def  lowerCamelCase_	(       self     :		Tuple		,					UpperCAmelCase__     :		Path		,					UpperCAmelCase__     :		Union[str, None] = None		,					UpperCAmelCase__     :		Union[List[str], None] = None		,					UpperCAmelCase__     :		Union[str, List[str], None] = None		,					UpperCAmelCase__     :		bool = True		,					):
										'''simple docstring'''
										lowercase :							List[Any]    		=[file for file in os.listdir(UpperCAmelCase__   ) if os.path.isfile(os.path.join(UpperCAmelCase__		,					UpperCAmelCase__   )   )]

										if identifier is not None:
																lowercase :							List[str]    		=[file for file in files if identifier in file]

										if n_identifier is not None:
																if isinstance(UpperCAmelCase__		,					UpperCAmelCase__   ):
																						for n_ in n_identifier:
																												lowercase :							Tuple    		=[file for file in files if n_ not in file]
																else:
																						lowercase :							int    		=[file for file in files if n_identifier not in file]

										lowercase :							Optional[Any]    		=ignore_files or []
										ignore_files.append('''__init__.py'''   )
										lowercase :							List[str]    		=[file for file in files if file not in ignore_files]

										for file in files:
																# Open all files
																print('''Testing'''		,					UpperCAmelCase__   )

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







				def  lowerCamelCase_	(       self     :		Optional[int]   ):
										'''simple docstring'''
										lowercase :							str    		=Path('''src/transformers'''   )
										lowercase :							Optional[Any]    		='''modeling'''
										lowercase :							Dict    		=[
										    '''modeling_ctrl.py''',
										    '''modeling_tf_ctrl.py''',
										]
										self.analyze_directory(UpperCAmelCase__		,					identifier=UpperCAmelCase__		,					ignore_files=UpperCAmelCase__   )







				def  lowerCamelCase_	(       self     :		Dict   ):
										'''simple docstring'''
										lowercase :							int    		=Path('''src/transformers'''   )
										lowercase :							List[str]    		='''tokenization'''
										self.analyze_directory(UpperCAmelCase__		,					identifier=UpperCAmelCase__   )







				def  lowerCamelCase_	(       self     :		int   ):
										'''simple docstring'''
										lowercase :							Dict    		=Path('''src/transformers'''   )
										lowercase :							Any    		='''configuration'''
										self.analyze_directory(UpperCAmelCase__		,					identifier=UpperCAmelCase__   )







				def  lowerCamelCase_	(       self     :		Optional[Any]   ):
										'''simple docstring'''
										lowercase :							str    		=Path('''src/transformers'''   )
										lowercase :							List[str]    		=['''configuration''', '''modeling''', '''tokenization''']
										self.analyze_directory(UpperCAmelCase__		,					n_identifier=UpperCAmelCase__   )







				def  lowerCamelCase_	(       self     :		int   ):
										'''simple docstring'''
										lowercase :							Any    		=Path('''docs/source'''   )
										lowercase :							List[Any]    		=['''favicon.ico''']
										self.analyze_directory(UpperCAmelCase__		,					ignore_files=UpperCAmelCase__		,					only_modules=UpperCAmelCase__   )






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


__a    :	List[Any]         =    logging.get_logger(__name__)

__a    :	List[Any]         =    {
    """MIT/ast-finetuned-audioset-10-10-0.4593""": (
        """https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config.json"""
    ),
}




class   _UpperCamelCase (		_UpperCAmelCase					):


			"""simple docstring"""






			__a    :					Optional[Any]     					=		'''audio-spectrogram-transformer'''





			def __init__(  self ,  lowerCAmelCase__=7_68 ,  lowerCAmelCase__=12 ,  lowerCAmelCase__=12 ,  lowerCAmelCase__=30_72 ,  lowerCAmelCase__="gelu" ,  lowerCAmelCase__=0.0 ,  lowerCAmelCase__=0.0 ,  lowerCAmelCase__=0.02 ,  lowerCAmelCase__=1E-12 ,  lowerCAmelCase__=16 ,  lowerCAmelCase__=True ,  lowerCAmelCase__=10 ,  lowerCAmelCase__=10 ,  lowerCAmelCase__=10_24 ,  lowerCAmelCase__=1_28 ,  **lowerCAmelCase__ ,  )	->   Optional[Any]:

							'''simple docstring'''


							super().__init__(**lowerCAmelCase__		)

							__lowercase					     =				hidden_size
							__lowercase					     =				num_hidden_layers
							__lowercase					     =				num_attention_heads
							__lowercase					     =				intermediate_size
							__lowercase					     =				hidden_act
							__lowercase					     =				hidden_dropout_prob
							__lowercase					     =				attention_probs_dropout_prob
							__lowercase					     =				initializer_range
							__lowercase					     =				layer_norm_eps
							__lowercase					     =				patch_size
							__lowercase					     =				qkv_bias
							__lowercase					     =				frequency_stride
							__lowercase					     =				time_stride
							__lowercase					     =				max_length
							__lowercase					     =				num_mel_bins