






'''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 							__SCREAMING_SNAKE_CASE       (							unittest.TestCase     ):




      @require_torch
      def  __UpperCamelCase							(  self      )							->Optional[Any]:



         '''simple docstring'''
         __a				     =    pipeline(
             task='zero-shot-audio-classification' ,   model='hf-internal-testing/tiny-clap-htsat-unfused'      )
         __a				     =    load_dataset('ashraq/esc50'      )
         __a				     =    dataset['train']['audio'][-1]['array']
         __a				     =    audio_classifier(lowerCamelCase ,   candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner']      )
         self.assertEqual(
             nested_simplify(lowerCamelCase      ) ,   [{'score': 0.501, 'label': 'Sound of a dog'}, {'score': 0.499, 'label': 'Sound of vaccum cleaner'}] ,   )




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



         '''simple docstring'''
         pass




      @slow
      @require_torch
      def  __UpperCamelCase							(  self      )							->Tuple:



         '''simple docstring'''
         __a				     =    pipeline(
             task='zero-shot-audio-classification' ,   model='laion/clap-htsat-unfused' ,   )
         # This is an audio of a dog
         __a				     =    load_dataset('ashraq/esc50'      )
         __a				     =    dataset['train']['audio'][-1]['array']
         __a				     =    audio_classifier(lowerCamelCase ,   candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner']      )

         self.assertEqual(
             nested_simplify(lowerCamelCase      ) ,   [
                 {'score': 0.999, 'label': 'Sound of a dog'},
                 {'score': 0.001, 'label': 'Sound of vaccum cleaner'},
             ] ,   )

         __a				     =    audio_classifier([audio] * 5 ,   candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner']      )
         self.assertEqual(
             nested_simplify(lowerCamelCase      ) ,   [
                 [
                     {'score': 0.999, 'label': 'Sound of a dog'},
                     {'score': 0.001, 'label': 'Sound of vaccum cleaner'},
                 ],
             ]
             * 5 ,   )
         __a				     =    audio_classifier(
             [audio] * 5 ,   candidate_labels=['Sound of a dog', 'Sound of vaccum cleaner'] ,   batch_size=5      )
         self.assertEqual(
             nested_simplify(lowerCamelCase      ) ,   [
                 [
                     {'score': 0.999, 'label': 'Sound of a dog'},
                     {'score': 0.001, 'label': 'Sound of vaccum cleaner'},
                 ],
             ]
             * 5 ,   )






      @unittest.skip('No models are available in TF'      )
      def  __UpperCamelCase							(  self      )							->Any:



         '''simple docstring'''
         pass







'''simple docstring'''



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


__UpperCamelCase      :       List[str]      			=      logging.get_logger(__name__)

__UpperCamelCase      :       Tuple      			=      {
    """sayakpaul/vit-msn-base""": """https://huggingface.co/sayakpaul/vit-msn-base/resolve/main/config.json""",
    # See all ViT MSN models at https://huggingface.co/models?filter=vit_msn
}
class 							__SCREAMING_SNAKE_CASE       (							_lowerCAmelCase     ):
      __a  					="vit_msn"




      def __init__(  self ,   lowerCamelCase=768 ,   lowerCamelCase=12 ,   lowerCamelCase=12 ,   lowerCamelCase=3072 ,   lowerCamelCase="gelu" ,   lowerCamelCase=0.0 ,   lowerCamelCase=0.0 ,   lowerCamelCase=0.02 ,   lowerCamelCase=1e-06 ,   lowerCamelCase=224 ,   lowerCamelCase=16 ,   lowerCamelCase=3 ,   lowerCamelCase=True ,   **lowerCamelCase ,   )							->Tuple:



         '''simple docstring'''
         super().__init__(**lowerCamelCase      )

         __a				     =    hidden_size
         __a				     =    num_hidden_layers
         __a				     =    num_attention_heads
         __a				     =    intermediate_size
         __a				     =    hidden_act
         __a				     =    hidden_dropout_prob
         __a				     =    attention_probs_dropout_prob
         __a				     =    initializer_range
         __a				     =    layer_norm_eps
         __a				     =    image_size
         __a				     =    patch_size
         __a				     =    num_channels
         __a				     =    qkv_bias