'''simple docstring'''

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


__a:			Union[str, Any]	       =       logging.get_logger(__name__)

__a:			Union[str, Any]	       =       {
    """uw-madison/mra-base-512-4""": """https://huggingface.co/uw-madison/mra-base-512-4/resolve/main/config.json""",
}



class       UpperCAmelCase  (						a__ ):





       '''simple docstring'''



       SCREAMING_SNAKE_CASE 		=   "mra"

       def __init__(						self     ,       __lowerCAmelCase=50265     ,       __lowerCAmelCase=768     ,       __lowerCAmelCase=12     ,       __lowerCAmelCase=12     ,       __lowerCAmelCase=3072     ,       __lowerCAmelCase="gelu"     ,       __lowerCAmelCase=0.1     ,       __lowerCAmelCase=0.1     ,       __lowerCAmelCase=512     ,       __lowerCAmelCase=1     ,       __lowerCAmelCase=0.0_2     ,       __lowerCAmelCase=1E-5     ,       __lowerCAmelCase="absolute"     ,       __lowerCAmelCase=4     ,       __lowerCAmelCase="full"     ,       __lowerCAmelCase=0     ,       __lowerCAmelCase=0     ,       __lowerCAmelCase=1     ,       __lowerCAmelCase=0     ,       __lowerCAmelCase=2     ,       **__lowerCAmelCase     ,       )  ->  int:
        super().__init__(pad_token_id=__lowerCAmelCase     ,       bos_token_id=__lowerCAmelCase     ,       eos_token_id=__lowerCAmelCase     ,       **__lowerCAmelCase			)

        lowercase__    :   Optional[Any]						= vocab_size
        lowercase__    :   Optional[int]						= max_position_embeddings
        lowercase__    :   List[str]						= hidden_size
        lowercase__    :   str						= num_hidden_layers
        lowercase__    :   Union[str, Any]						= num_attention_heads
        lowercase__    :   str						= intermediate_size
        lowercase__    :   int						= hidden_act
        lowercase__    :   Optional[Any]						= hidden_dropout_prob
        lowercase__    :   Tuple						= attention_probs_dropout_prob
        lowercase__    :   Optional[Any]						= initializer_range
        lowercase__    :   int						= type_vocab_size
        lowercase__    :   Optional[Any]						= layer_norm_eps
        lowercase__    :   List[Any]						= position_embedding_type
        lowercase__    :   Union[str, Any]						= block_per_row
        lowercase__    :   Union[str, Any]						= approx_mode
        lowercase__    :   Optional[Any]						= initial_prior_first_n_blocks
        lowercase__    :   Union[str, Any]						= initial_prior_diagonal_n_blocks


'''simple docstring'''

import unittest

from datasets import load_dataset

from transformers.pipelines import pipeline
from transformers.testing_utils import is_pipeline_test, nested_simplify, require_torch, slow



@is_pipeline_test
@require_torch
class       UpperCAmelCase  (						unittest.TestCase ):





       '''simple docstring'''



       @require_torch
       def _lowerCAmelCase(						self			)  ->  int:
        lowercase__    :   str						= pipeline(
            task='''zero-shot-audio-classification'''     ,       model='''hf-internal-testing/tiny-clap-htsat-unfused'''			)
        lowercase__    :   Optional[Any]						= load_dataset('''ashraq/esc50'''			)
        lowercase__    :   Tuple						= dataset['''train''']['''audio'''][-1]['''array''']
        lowercase__    :   Optional[Any]						= audio_classifier(__lowerCAmelCase     ,       candidate_labels=['''Sound of a dog''', '''Sound of vaccum cleaner''']			)
        self.assertEqual(
            nested_simplify(__lowerCAmelCase			)     ,       [{'''score''': 0.5_0_1, '''label''': '''Sound of a dog'''}, {'''score''': 0.4_9_9, '''label''': '''Sound of vaccum cleaner'''}]     ,       )

       @unittest.skip('''No models are available in TF'''			)
       def _lowerCAmelCase(						self			)  ->  str:
        pass

       @slow
       @require_torch
       def _lowerCAmelCase(						self			)  ->  Tuple:
        lowercase__    :   List[str]						= pipeline(
            task='''zero-shot-audio-classification'''     ,       model='''laion/clap-htsat-unfused'''     ,       )
        # This is an audio of a dog
        lowercase__    :   int						= load_dataset('''ashraq/esc50'''			)
        lowercase__    :   str						= dataset['''train''']['''audio'''][-1]['''array''']
        lowercase__    :   Any						= audio_classifier(__lowerCAmelCase     ,       candidate_labels=['''Sound of a dog''', '''Sound of vaccum cleaner''']			)

        self.assertEqual(
            nested_simplify(__lowerCAmelCase			)     ,       [
                {'''score''': 0.9_9_9, '''label''': '''Sound of a dog'''},
                {'''score''': 0.0_0_1, '''label''': '''Sound of vaccum cleaner'''},
            ]     ,       )

        lowercase__    :   Dict						= audio_classifier([audio] * 5     ,       candidate_labels=['''Sound of a dog''', '''Sound of vaccum cleaner''']			)
        self.assertEqual(
            nested_simplify(__lowerCAmelCase			)     ,       [
                [
                    {'''score''': 0.9_9_9, '''label''': '''Sound of a dog'''},
                    {'''score''': 0.0_0_1, '''label''': '''Sound of vaccum cleaner'''},
                ],
            ]
            * 5     ,       )
        lowercase__    :   Any						= audio_classifier(
            [audio] * 5     ,       candidate_labels=['''Sound of a dog''', '''Sound of vaccum cleaner''']     ,       batch_size=5			)
        self.assertEqual(
            nested_simplify(__lowerCAmelCase			)     ,       [
                [
                    {'''score''': 0.9_9_9, '''label''': '''Sound of a dog'''},
                    {'''score''': 0.0_0_1, '''label''': '''Sound of vaccum cleaner'''},
                ],
            ]
            * 5     ,       )


       @unittest.skip('''No models are available in TF'''			)
       def _lowerCAmelCase(						self			)  ->  Union[str, Any]:
        pass

