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


__lowerCamelCase      :			Optional[Any]							       =		logging.get_logger(__name__)

__lowerCamelCase      :			Optional[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 __snake_case    (						a_		):
   lowerCAmelCase_														=							"audio-spectrogram-transformer"




   def __init__(   self      :    List[Any]	,     _lowercase      :    Tuple=7_68	,     _lowercase      :    Dict=12	,     _lowercase      :    int=12	,     _lowercase      :    str=30_72	,     _lowercase      :    Tuple="gelu"	,     _lowercase      :    Optional[int]=0.0	,     _lowercase      :    Optional[int]=0.0	,     _lowercase      :    Tuple=0.02	,     _lowercase      :    str=1E-12	,     _lowercase      :    Union[str, Any]=16	,     _lowercase      :    Tuple=True	,     _lowercase      :    List[Any]=10	,     _lowercase      :    str=10	,     _lowercase      :    List[Any]=10_24	,     _lowercase      :    Tuple=1_28	,     **_lowercase      :    List[Any]	,     ):



     """simple docstring"""






     super().__init__(**_lowercase				)

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




import unittest

from transformers import is_torch_available
from transformers.testing_utils import require_sentencepiece, require_tokenizers, require_torch, slow, torch_device


if is_torch_available():
   from transformers import AutoModelForSeqaSeqLM, AutoTokenizer







@require_torch
@require_sentencepiece
@require_tokenizers
class __snake_case    (						unittest.TestCase		):




   @slow
   def      __a						(   self      :    List[str]				):



     """simple docstring"""






     SCREAMING_SNAKE_CASE__      							=				AutoModelForSeqaSeqLM.from_pretrained("""google/mt5-small"""	,     return_dict=_lowercase				).to(_lowercase				)
     SCREAMING_SNAKE_CASE__      							=				AutoTokenizer.from_pretrained("""google/mt5-small"""				)

     SCREAMING_SNAKE_CASE__      							=				tokenizer("""Hello there"""	,     return_tensors="""pt"""				).input_ids
     SCREAMING_SNAKE_CASE__      							=				tokenizer("""Hi I am"""	,     return_tensors="""pt"""				).input_ids

     SCREAMING_SNAKE_CASE__      							=				model(input_ids.to(_lowercase				)	,     labels=labels.to(_lowercase				)				).loss
     SCREAMING_SNAKE_CASE__      							=				-(labels.shape[-1] * loss.item())

     SCREAMING_SNAKE_CASE__      							=				-84.91_27
     self.assertTrue(abs(mtf_score - EXPECTED_SCORE				) < 1E-4				)
