




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

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

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

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

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







lowerCAmelCase_					    = 6_55_21



def      __lowerCAmelCase			(					UpperCamelCase      )     ->	int:
  lowerCAmelCase__				:  List[str]		       =     1
  lowerCAmelCase__				:  List[Any]		       =     0
  for plain_chr in plain_text:
    lowerCAmelCase__				:  Union[str, Any]		       =     (a + ord(UpperCamelCase      )) % MOD_ADLER
    lowerCAmelCase__				:  Optional[Any]		       =     (b + a) % MOD_ADLER
  return (b << 16) | a

