






"""simple docstring"""






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


UpperCAmelCase_   : List[Any]   			= logging.get_logger(__name__)

UpperCAmelCase_   : List[Any]   			= {
    'bigcode/gpt_bigcode-santacoder': 'https://huggingface.co/bigcode/gpt_bigcode-santacoder/resolve/main/config.json',
}




class 							lowerCAmelCase__				(			UpperCAmelCase__ ):






      '''simple docstring'''

      __UpperCamelCase	 =  "gpt_bigcode"
      __UpperCamelCase	 =  ["past_key_values"]
      __UpperCamelCase	 =  {
          "hidden_size": "n_embd",
          "max_position_embeddings": "n_positions",
          "num_attention_heads": "n_head",
          "num_hidden_layers": "n_layer",
      }
      def __init__(						self     :  List[Any]						,	lowercase_     :  Tuple=50257						,	lowercase_     :  Union[str, Any]=1024						,	lowercase_     :  Dict=768						,	lowercase_     :  Optional[int]=12						,	lowercase_     :  Tuple=12						,	lowercase_     :  Union[str, Any]=None						,	lowercase_     :  List[Any]="gelu_pytorch_tanh"						,	lowercase_     :  Optional[Any]=0.1						,	lowercase_     :  Dict=0.1						,	lowercase_     :  int=0.1						,	lowercase_     :  Optional[Any]=1e-5						,	lowercase_     :  Dict=0.02						,	lowercase_     :  Optional[Any]=True						,	lowercase_     :  Tuple=True						,	lowercase_     :  Optional[int]=50256						,	lowercase_     :  Union[str, Any]=50256						,	lowercase_     :  List[str]=True						,	lowercase_     :  Optional[int]=True						,	lowercase_     :  Tuple=True						,	**lowercase_     :  Optional[int]						,	):




          '''simple docstring'''


          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		vocab_size
          SCREAMING_SNAKE_CASE_      :  Dict    						=		n_positions
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		n_embd
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		n_layer
          SCREAMING_SNAKE_CASE_      :  Optional[Any]    						=		n_head
          SCREAMING_SNAKE_CASE_      :  str    						=		n_inner
          SCREAMING_SNAKE_CASE_      :  Dict    						=		activation_function
          SCREAMING_SNAKE_CASE_      :  int    						=		resid_pdrop
          SCREAMING_SNAKE_CASE_      :  Tuple    						=		embd_pdrop
          SCREAMING_SNAKE_CASE_      :  Dict    						=		attn_pdrop
          SCREAMING_SNAKE_CASE_      :  Optional[Any]    						=		layer_norm_epsilon
          SCREAMING_SNAKE_CASE_      :  Optional[Any]    						=		initializer_range
          SCREAMING_SNAKE_CASE_      :  Tuple    						=		scale_attn_weights
          SCREAMING_SNAKE_CASE_      :  Optional[int]    						=		use_cache
          SCREAMING_SNAKE_CASE_      :  List[str]    						=		attention_softmax_in_fpaa
          SCREAMING_SNAKE_CASE_      :  Dict    						=		scale_attention_softmax_in_fpaa
          SCREAMING_SNAKE_CASE_      :  Union[str, Any]    						=		multi_query

          SCREAMING_SNAKE_CASE_      :  Any    						=		bos_token_id
          SCREAMING_SNAKE_CASE_      :  Any    						=		eos_token_id

          super().__init__(bos_token_id=lowercase_						,	eos_token_id=lowercase_						,	**lowercase_)







"""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		)							->					Any:
         _UpperCAmelCase							:  str											=    pipeline(
             task='''zero-shot-audio-classification'''       ,	model='''hf-internal-testing/tiny-clap-htsat-unfused'''		)
         _UpperCAmelCase							:  List[Any]											=    load_dataset('''ashraq/esc50'''		)
         _UpperCAmelCase							:  Optional[int]											=    dataset['''train''']['''audio'''][-1]['''array''']
         _UpperCAmelCase							:  str											=    audio_classifier(A       ,	candidate_labels=['''Sound of a dog''', '''Sound of vaccum cleaner''']		)
         self.assertEqual(
             nested_simplify(A		)       ,	[{'''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  __lowerCAmelCase	(					self		)							->					Union[str, Any]:
         pass





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

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

         _UpperCAmelCase							:  List[Any]											=    audio_classifier([audio] * 5       ,	candidate_labels=['''Sound of a dog''', '''Sound of vaccum cleaner''']		)
         self.assertEqual(
             nested_simplify(A		)       ,	[
                 [
                     {'''score''': 0.999, '''label''': '''Sound of a dog'''},
                     {'''score''': 0.001, '''label''': '''Sound of vaccum cleaner'''},
                 ],
             ]
             * 5       ,	)
         _UpperCAmelCase							:  Tuple											=    audio_classifier(
             [audio] * 5       ,	candidate_labels=['''Sound of a dog''', '''Sound of vaccum cleaner''']       ,	batch_size=5		)
         self.assertEqual(
             nested_simplify(A		)       ,	[
                 [
                     {'''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  __lowerCAmelCase	(					self		)							->					int:
         pass


