

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


__A			:					Dict						=			logging.get_logger(__name__)

__A			:					Union[str, Any]						=			{
    'MIT/ast-finetuned-audioset-10-10-0.4593': (
        'https://huggingface.co/MIT/ast-finetuned-audioset-10-10-0.4593/resolve/main/config.json'
    ),
}





class 			_SCREAMING_SNAKE_CASE (   __snake_case		):







   '''simple docstring'''




   lowerCamelCase__				=      "audio-spectrogram-transformer"





   def __init__(       self					:			int     , __lowerCamelCase					:			str=768     , __lowerCamelCase					:			int=12     , __lowerCamelCase					:			Optional[Any]=12     , __lowerCamelCase					:			Union[str, Any]=3072     , __lowerCamelCase					:			List[Any]="gelu"     , __lowerCamelCase					:			Tuple=0.0     , __lowerCamelCase					:			Any=0.0     , __lowerCamelCase					:			Any=0.02     , __lowerCamelCase					:			str=1e-12     , __lowerCamelCase					:			Any=16     , __lowerCamelCase					:			str=True     , __lowerCamelCase					:			List[str]=10     , __lowerCamelCase					:			Dict=10     , __lowerCamelCase					:			List[str]=1024     , __lowerCamelCase					:			List[Any]=128     , **__lowerCamelCase					:			Optional[int]     , ):
       super().__init__(**__lowerCamelCase			)

       SCREAMING_SNAKE_CASE										=   hidden_size
       SCREAMING_SNAKE_CASE										=   num_hidden_layers
       SCREAMING_SNAKE_CASE										=   num_attention_heads
       SCREAMING_SNAKE_CASE										=   intermediate_size
       SCREAMING_SNAKE_CASE										=   hidden_act
       SCREAMING_SNAKE_CASE										=   hidden_dropout_prob
       SCREAMING_SNAKE_CASE										=   attention_probs_dropout_prob
       SCREAMING_SNAKE_CASE										=   initializer_range
       SCREAMING_SNAKE_CASE										=   layer_norm_eps
       SCREAMING_SNAKE_CASE										=   patch_size
       SCREAMING_SNAKE_CASE										=   qkv_bias
       SCREAMING_SNAKE_CASE										=   frequency_stride
       SCREAMING_SNAKE_CASE										=   time_stride
       SCREAMING_SNAKE_CASE										=   max_length
       SCREAMING_SNAKE_CASE										=   num_mel_bins







from typing import Dict

from .base import GenericTensor, Pipeline
class  _UpperCAmelCase   (			A__      ):

				"""simple docstring"""




				def 							lowercase__  (	self		:       Any,    lowerCamelCase		:       Tuple=None,    lowerCamelCase		:       Union[str, Any]=None,    lowerCamelCase		:       Union[str, Any]=None,    **lowerCamelCase		:       List[Any]    ):

								'''simple docstring'''
								if tokenize_kwargs is None:
												lowercase__  					=     {}

								if truncation is not None:
												if "truncation" in tokenize_kwargs:
																raise ValueError(
																    '''truncation parameter defined twice (given as keyword argument as well as in tokenize_kwargs)'''    )
												lowercase__  					=     truncation

								lowercase__  					=     tokenize_kwargs

								lowercase__  					=     {}
								if return_tensors is not None:
												lowercase__  					=     return_tensors

								return preprocess_params, {}, postprocess_params




				def 							lowercase__  (	self		:       Tuple,    lowerCamelCase		:       Optional[int],    **lowerCamelCase		:       List[Any]    ):

								'''simple docstring'''
								lowercase__  					=     self.framework
								lowercase__  					=     self.tokenizer(lowerCamelCase,    return_tensors=lowerCamelCase,    **lowerCamelCase    )
								return model_inputs




				def 							lowercase__  (	self		:       Union[str, Any],    lowerCamelCase		:       Dict    ):

								'''simple docstring'''
								lowercase__  					=     self.model(**lowerCamelCase    )
								return model_outputs




				def 							lowercase__  (	self		:       Union[str, Any],    lowerCamelCase		:       Dict,    lowerCamelCase		:       Tuple=False    ):

								'''simple docstring'''
								# [0] is the first available tensor, logits or last_hidden_state.
								if return_tensors:
												return model_outputs[0]
								if self.framework == "pt":
												return model_outputs[0].tolist()
								elif self.framework == "tf":
												return model_outputs[0].numpy().tolist()




				def __call__(	self		:       List[str],    *lowerCamelCase		:       List[Any],    **lowerCamelCase		:       str    ):

								'''simple docstring'''
								return super().__call__(*lowerCamelCase,    **lowerCamelCase    )




