"""simple docstring"""
import time
from contextlib import contextmanager
from pathlib import Path

import pytest
import requests
from huggingface_hub.hf_api import HfApi, HfFolder


lowercase__					       =	'__DUMMY_TRANSFORMERS_USER__'
lowercase__					       =	'Dummy User'
lowercase__					       =	'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'

lowercase__					       =	'https://hub-ci.huggingface.co'
lowercase__					       =	CI_HUB_ENDPOINT + '/datasets/{repo_id}/resolve/{revision}/{path}'
lowercase__					       =	CI_HUB_ENDPOINT + '/{repo_id}/resolve/{revision}/{filename}'
lowercase__					       =	Path('~/.huggingface/hub_ci_token').expanduser()







@pytest.fixture
def 						__a   (	_SCREAMING_SNAKE_CASE   )	->List[str]:
  monkeypatch.setattr(
      'huggingface_hub.file_download.HUGGINGFACE_CO_URL_TEMPLATE'		,     _SCREAMING_SNAKE_CASE   )







@pytest.fixture
def 						__a   (	_SCREAMING_SNAKE_CASE   )	->str:
  monkeypatch.setattr('datasets.config.HF_ENDPOINT'		,     _SCREAMING_SNAKE_CASE   )
  monkeypatch.setattr('datasets.config.HUB_DATASETS_URL'		,     _SCREAMING_SNAKE_CASE   )







@pytest.fixture
def 						__a   (	_SCREAMING_SNAKE_CASE   )	->str:
  monkeypatch.setattr('huggingface_hub.hf_api.HfFolder.path_token'		,     _SCREAMING_SNAKE_CASE   )







@pytest.fixture
def 						__a   (	_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )	->Union[str, Any]:
  HfFolder.save_token(_SCREAMING_SNAKE_CASE   )
  yield
  HfFolder.delete_token()







@pytest.fixture(scope='session'   )
def 						__a   (	)	->Optional[int]:
  return HfApi(endpoint=_SCREAMING_SNAKE_CASE   )







@pytest.fixture(scope='session'   )
def 						__a   (	_SCREAMING_SNAKE_CASE   )	->Optional[int]:
  a__:     Union[str, Any]										=	HfFolder.get_token()
  HfFolder.save_token(_SCREAMING_SNAKE_CASE   )
  yield CI_HUB_USER_TOKEN
  if previous_token is not None:
    HfFolder.save_token(_SCREAMING_SNAKE_CASE   )







@pytest.fixture
def 						__a   (	_SCREAMING_SNAKE_CASE   )	->Union[str, Any]:
  def _cleanup_repo(_SCREAMING_SNAKE_CASE   ):
    hf_api.delete_repo(_SCREAMING_SNAKE_CASE		,     token=_SCREAMING_SNAKE_CASE		,     repo_type='dataset'   )

  return _cleanup_repo







@pytest.fixture
def 						__a   (	_SCREAMING_SNAKE_CASE   )	->List[str]:
  @contextmanager
  def _temporary_repo(_SCREAMING_SNAKE_CASE   ):
    try:
      yield repo_id
    finally:
      cleanup_repo(_SCREAMING_SNAKE_CASE   )

  return _temporary_repo







@pytest.fixture(scope='session'   )
def 						__a   (	_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )	->List[Any]:
  a__:     List[Any]										=	F'repo_txt_data-{int(time.time() * 10e3   )}'
  a__:     str										=	F'{CI_HUB_USER}/{repo_name}'
  hf_api.create_repo(_SCREAMING_SNAKE_CASE		,     token=_SCREAMING_SNAKE_CASE		,     repo_type='dataset'		,     private=_SCREAMING_SNAKE_CASE   )
  hf_api.upload_file(
      token=_SCREAMING_SNAKE_CASE		,     path_or_fileobj=str(_SCREAMING_SNAKE_CASE   )		,     path_in_repo='data/text_data.txt'		,     repo_id=_SCREAMING_SNAKE_CASE		,     repo_type='dataset'		,     )
  yield repo_id
  try:
    hf_api.delete_repo(_SCREAMING_SNAKE_CASE		,     token=_SCREAMING_SNAKE_CASE		,     repo_type='dataset'   )
  except (requests.exceptions.HTTPError, ValueError):  # catch http error and token invalid error
    pass







@pytest.fixture()
def 						__a   (	_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )	->Any:
  return hf_private_dataset_repo_txt_data_







@pytest.fixture(scope='session'   )
def 						__a   (	_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )	->List[Any]:
  a__:     Optional[Any]										=	F'repo_zipped_txt_data-{int(time.time() * 10e3   )}'
  a__:     Any										=	F'{CI_HUB_USER}/{repo_name}'
  hf_api.create_repo(_SCREAMING_SNAKE_CASE		,     token=_SCREAMING_SNAKE_CASE		,     repo_type='dataset'		,     private=_SCREAMING_SNAKE_CASE   )
  hf_api.upload_file(
      token=_SCREAMING_SNAKE_CASE		,     path_or_fileobj=str(_SCREAMING_SNAKE_CASE   )		,     path_in_repo='data.zip'		,     repo_id=_SCREAMING_SNAKE_CASE		,     repo_type='dataset'		,     )
  yield repo_id
  try:
    hf_api.delete_repo(_SCREAMING_SNAKE_CASE		,     token=_SCREAMING_SNAKE_CASE		,     repo_type='dataset'   )
  except (requests.exceptions.HTTPError, ValueError):  # catch http error and token invalid error
    pass







@pytest.fixture()
def 						__a   (	_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )	->Tuple:
  return hf_private_dataset_repo_zipped_txt_data_







@pytest.fixture(scope='session'   )
def 						__a   (	_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )	->List[str]:
  a__:     str										=	F'repo_zipped_img_data-{int(time.time() * 10e3   )}'
  a__:     List[Any]										=	F'{CI_HUB_USER}/{repo_name}'
  hf_api.create_repo(_SCREAMING_SNAKE_CASE		,     token=_SCREAMING_SNAKE_CASE		,     repo_type='dataset'		,     private=_SCREAMING_SNAKE_CASE   )
  hf_api.upload_file(
      token=_SCREAMING_SNAKE_CASE		,     path_or_fileobj=str(_SCREAMING_SNAKE_CASE   )		,     path_in_repo='data.zip'		,     repo_id=_SCREAMING_SNAKE_CASE		,     repo_type='dataset'		,     )
  yield repo_id
  try:
    hf_api.delete_repo(_SCREAMING_SNAKE_CASE		,     token=_SCREAMING_SNAKE_CASE		,     repo_type='dataset'   )
  except (requests.exceptions.HTTPError, ValueError):  # catch http error and token invalid error
    pass







@pytest.fixture()
def 						__a   (	_SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE		,     _SCREAMING_SNAKE_CASE   )	->Dict:
  return hf_private_dataset_repo_zipped_img_data_



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


lowercase__					       =	logging.get_logger(__name__)

lowercase__					       =	{
    'MIT/ast-finetuned-audioset-10-10-0.4593': (
        'https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config.json'
    ),
}




class    __snake_case       (     __lowerCAmelCase				):
      a__        =		"""audio-spectrogram-transformer"""



      def __init__(						self    ,			lowercase=7_68    ,			lowercase=12    ,			lowercase=12    ,			lowercase=30_72    ,			lowercase="gelu"    ,			lowercase=0.0    ,			lowercase=0.0    ,			lowercase=0.02    ,			lowercase=1e-12    ,			lowercase=16    ,			lowercase=True    ,			lowercase=10    ,			lowercase=10    ,			lowercase=10_24    ,			lowercase=1_28    ,			**lowercase    ,			)	->			str:





        '''simple docstring'''





        super().__init__(**lowercase)

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


