





'''simple docstring'''





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


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

__lowercase       :Union[str, Any]       =  {
    '''tanreinama/GPTSAN-2.8B-spout_is_uniform''': (
        '''https://huggingface.co/tanreinama/GPTSAN-2.8B-spout_is_uniform/resolve/main/config.json'''
    ),
}



class    _a     (				SCREAMING_SNAKE_CASE__							):






							"""simple docstring"""

							snake_case_							 =						"gptsan-japanese"
							snake_case_							 =						[
							    "past_key_values",
							]
							snake_case_							 =						{
							    "hidden_size": "d_model",
							    "num_attention_heads": "num_heads",
							    "num_hidden_layers": "num_layers",
							}

							def __init__(      self				:     List[str]							,	a				:     int=3_60_00							,	a				:     Dict=12_80							,	a				:     Optional[Any]=10_24							,	a				:     Dict=81_92							,	a				:     List[Any]=40_96							,	a				:     List[str]=1_28							,	a				:     Dict=10							,	a				:     Tuple=0							,	a				:     Any=16							,	a				:     str=16							,	a				:     Optional[int]=1_28							,	a				:     Tuple=0.0							,	a				:     Optional[Any]=1E-5							,	a				:     str=False							,	a				:     str=0.0							,	a				:     Optional[int]="float32"							,	a				:     Dict=False							,	a				:     Dict=False							,	a				:     Optional[Any]=False							,	a				:     Tuple=0.002							,	a				:     List[str]=False							,	a				:     Union[str, Any]=True							,	a				:     Dict=3_59_98							,	a				:     Dict=3_59_95							,	a				:     Any=3_59_99							,	**a				:     Optional[int]							,	)	->int:
													SCREAMING_SNAKE_CASE__     :				Any   =					vocab_size
													SCREAMING_SNAKE_CASE__     :				int   =					max_position_embeddings
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					d_model
													SCREAMING_SNAKE_CASE__     :				Any   =					d_ff
													SCREAMING_SNAKE_CASE__     :				List[str]   =					d_ext
													SCREAMING_SNAKE_CASE__     :				str   =					d_spout
													SCREAMING_SNAKE_CASE__     :				str   =					num_switch_layers
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					num_ext_layers
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					num_switch_layers + num_ext_layers
													SCREAMING_SNAKE_CASE__     :				List[str]   =					num_heads
													SCREAMING_SNAKE_CASE__     :				Any   =					num_experts
													SCREAMING_SNAKE_CASE__     :				List[str]   =					expert_capacity
													SCREAMING_SNAKE_CASE__     :				Dict   =					dropout_rate
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					layer_norm_epsilon
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					router_bias
													SCREAMING_SNAKE_CASE__     :				Tuple   =					router_jitter_noise
													SCREAMING_SNAKE_CASE__     :				str   =					router_dtype
													SCREAMING_SNAKE_CASE__     :				Tuple   =					router_ignore_padding_tokens
													SCREAMING_SNAKE_CASE__     :				str   =					output_hidden_states
													SCREAMING_SNAKE_CASE__     :				Optional[Any]   =					output_attentions
													SCREAMING_SNAKE_CASE__     :				str   =					initializer_factor
													SCREAMING_SNAKE_CASE__     :				Tuple   =					output_router_logits
													SCREAMING_SNAKE_CASE__     :				List[Any]   =					use_cache

													super().__init__(
													    separator_token_id=_lowercase							,	pad_token_id=_lowercase							,	eos_token_id=_lowercase							,	**_lowercase							,	)






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






							"""simple docstring"""

							@require_torch
							def      A_  (      self				:     Dict    )	->str:
													SCREAMING_SNAKE_CASE__     :				Any   =					pipeline(
													    task="zero-shot-audio-classification"							,	model="hf-internal-testing/tiny-clap-htsat-unfused"    )
													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					load_dataset("ashraq/esc50"    )
													SCREAMING_SNAKE_CASE__     :				Optional[int]   =					dataset["train"]["audio"][-1]["array"]
													SCREAMING_SNAKE_CASE__     :				int   =					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      A_  (      self				:     int    )	->Union[str, Any]:
													pass

							@slow
							@require_torch
							def      A_  (      self				:     int    )	->str:
													SCREAMING_SNAKE_CASE__     :				List[str]   =					pipeline(
													    task="zero-shot-audio-classification"							,	model="laion/clap-htsat-unfused"							,	)
													# This is an audio of a dog
													SCREAMING_SNAKE_CASE__     :				int   =					load_dataset("ashraq/esc50"    )
													SCREAMING_SNAKE_CASE__     :				str   =					dataset["train"]["audio"][-1]["array"]
													SCREAMING_SNAKE_CASE__     :				List[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"},
													    ]							,	)

													SCREAMING_SNAKE_CASE__     :				Optional[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							,	)
													SCREAMING_SNAKE_CASE__     :				int   =					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      A_  (      self				:     Optional[int]    )	->Union[str, Any]:
													pass