



"""simple docstring"""
from ...configuration_utils import PretrainedConfig
from ...utils import logging


__a      =				logging.get_logger(__name__)

__a      =				{
    "MIT/ast-finetuned-audioset-10-10-0.4593": (
        "https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config.json"
    ),
}
class 				lowerCamelCase  (			_lowerCAmelCase				):






					'''simple docstring'''





					_A		:			Tuple						=     """audio-spectrogram-transformer"""






					def __init__(       self:							Tuple						,     snake_case:							Dict=768						,     snake_case:							Tuple=12						,     snake_case:							Tuple=12						,     snake_case:							str=3_072						,     snake_case:							List[Any]="gelu"						,     snake_case:							int=0.0						,     snake_case:							List[str]=0.0						,     snake_case:							Optional[Any]=0.0_2						,     snake_case:							Tuple=1E-12						,     snake_case:							int=16						,     snake_case:							List[str]=True						,     snake_case:							Dict=10						,     snake_case:							Dict=10						,     snake_case:							Any=1_024						,     snake_case:							List[str]=128						,     **snake_case:							List[str]						,     )   ->	Optional[int]:
											super().__init__(**snake_case						)

											snake_case_ :Optional[Any]						=			hidden_size
											snake_case_ :int						=			num_hidden_layers
											snake_case_ :Optional[int]						=			num_attention_heads
											snake_case_ :int						=			intermediate_size
											snake_case_ :Tuple						=			hidden_act
											snake_case_ :int						=			hidden_dropout_prob
											snake_case_ :Tuple						=			attention_probs_dropout_prob
											snake_case_ :Union[str, Any]						=			initializer_range
											snake_case_ :Any						=			layer_norm_eps
											snake_case_ :str						=			patch_size
											snake_case_ :List[str]						=			qkv_bias
											snake_case_ :str						=			frequency_stride
											snake_case_ :Any						=			time_stride
											snake_case_ :Dict						=			max_length
											snake_case_ :List[Any]						=			num_mel_bins




import os
import unittest

from huggingface_hub.utils import are_progress_bars_disabled

import transformers.models.bart.tokenization_bart
from transformers import logging
from transformers.testing_utils import CaptureLogger, mockenv, mockenv_context
from transformers.utils.logging import disable_progress_bar, enable_progress_bar





class       A    (   unittest.TestCase ):


							def 			_A       (self					):
									__lowercase=			logging.get_logger()

									# the current default level is logging.WARNING
									__lowercase=			logging.get_verbosity()

									logging.set_verbosity_error()
									self.assertEqual(logger.getEffectiveLevel()      ,				logging.get_verbosity()					)

									logging.set_verbosity_warning()
									self.assertEqual(logger.getEffectiveLevel()      ,				logging.get_verbosity()					)

									logging.set_verbosity_info()
									self.assertEqual(logger.getEffectiveLevel()      ,				logging.get_verbosity()					)

									logging.set_verbosity_debug()
									self.assertEqual(logger.getEffectiveLevel()      ,				logging.get_verbosity()					)

									# restore to the original level
									logging.set_verbosity(lowerCAmelCase					)


							def 			_A       (self					):
									__lowercase=			logging.get_verbosity()

									__lowercase=			logging.get_logger('transformers.models.bart.tokenization_bart'					)
									__lowercase=			'Testing 1, 2, 3'

									# should be able to log warnings (if default settings weren't overridden by `pytest --log-level-all`)
									if level_origin <= logging.WARNING:
											with CaptureLogger(lowerCAmelCase					) as cl:
													logger.warning(lowerCAmelCase					)
											self.assertEqual(cl.out      ,				msg + '\n'					)

									# this is setting the level for all of `transformers.*` loggers
									logging.set_verbosity_error()

									# should not be able to log warnings
									with CaptureLogger(lowerCAmelCase					) as cl:
											logger.warning(lowerCAmelCase					)
									self.assertEqual(cl.out      ,				''					)

									# should be able to log warnings again
									logging.set_verbosity_warning()
									with CaptureLogger(lowerCAmelCase					) as cl:
											logger.warning(lowerCAmelCase					)
									self.assertEqual(cl.out      ,				msg + '\n'					)

									# restore to the original level
									logging.set_verbosity(lowerCAmelCase					)


							@mockenv(TRANSFORMERS_VERBOSITY='error'					)
							def 			_A       (self					):
									# reset for the env var to take effect, next time some logger call is made
									transformers.utils.logging._reset_library_root_logger()
									# this action activates the env var
									__lowercase=			logging.get_logger('transformers.models.bart.tokenization_bart'					)

									__lowercase=			os.getenv('TRANSFORMERS_VERBOSITY'      ,				lowerCAmelCase					)
									__lowercase=			logging.log_levels[env_level_str]

									__lowercase=			logging.get_verbosity()
									self.assertEqual(
									    lowerCAmelCase      ,				lowerCAmelCase      ,				f'TRANSFORMERS_VERBOSITY={env_level_str}/{env_level}, but internal verbosity is {current_level}'      ,				)

									# restore to the original level
									__lowercase=			''
									transformers.utils.logging._reset_library_root_logger()


							@mockenv(TRANSFORMERS_VERBOSITY='super-error'					)
							def 			_A       (self					):
									# reset for the env var to take effect, next time some logger call is made
									transformers.utils.logging._reset_library_root_logger()
									__lowercase=			logging.logging.getLogger()
									with CaptureLogger(lowerCAmelCase					) as cl:
											# this action activates the env var
											logging.get_logger('transformers.models.bart.tokenization_bart'					)
									self.assertIn('Unknown option TRANSFORMERS_VERBOSITY=super-error'      ,				cl.out					)

									# no need to restore as nothing was changed







							def 			_A       (self					):
									# testing `logger.warning_advice()`
									transformers.utils.logging._reset_library_root_logger()

									__lowercase=			logging.get_logger('transformers.models.bart.tokenization_bart'					)
									__lowercase=			'Testing 1, 2, 3'

									with mockenv_context(TRANSFORMERS_NO_ADVISORY_WARNINGS='1'					):
											# nothing should be logged as env var disables this method
											with CaptureLogger(lowerCAmelCase					) as cl:
													logger.warning_advice(lowerCAmelCase					)
											self.assertEqual(cl.out      ,				''					)

									with mockenv_context(TRANSFORMERS_NO_ADVISORY_WARNINGS=''					):
											# should log normally as TRANSFORMERS_NO_ADVISORY_WARNINGS is unset
											with CaptureLogger(lowerCAmelCase					) as cl:
													logger.warning_advice(lowerCAmelCase					)
											self.assertEqual(cl.out      ,				msg + '\n'					)







def        _lowerCamelCase(	)						->	Optional[int]:

		'''simple docstring'''







		disable_progress_bar()
		assert are_progress_bars_disabled()

		enable_progress_bar()
		assert not are_progress_bars_disabled()






