






import math
from typing import Optional

import numpy as np

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


_A			:    Dict					  =logging.get_logger(__name__)

_A			:    Union[str, Any]					  ={
    'facebook/encodec_24khz': 'https://huggingface.co/facebook/encodec_24khz/resolve/main/config.json',
    'facebook/encodec_48khz': 'https://huggingface.co/facebook/encodec_48khz/resolve/main/config.json',
}

class _lowercase			(       snake_case__	):
							a          = """encodec"""




							def __init__(							self:       Optional[Any]    ,							UpperCamelCase__:       int=[1.5, 3.0, 6.0, 12.0, 24.0]    ,							UpperCamelCase__:       Dict=24_000    ,							UpperCamelCase__:       List[str]=1    ,							UpperCamelCase__:       Tuple=False    ,							UpperCamelCase__:       Tuple=None    ,							UpperCamelCase__:       Optional[Any]=None    ,							UpperCamelCase__:       Dict=128    ,							UpperCamelCase__:       int=32    ,							UpperCamelCase__:       Tuple=1    ,							UpperCamelCase__:       Any=[8, 5, 4, 2]    ,							UpperCamelCase__:       Union[str, Any]="weight_norm"    ,							UpperCamelCase__:       Dict=7    ,							UpperCamelCase__:       str=7    ,							UpperCamelCase__:       int=3    ,							UpperCamelCase__:       List[str]=2    ,							UpperCamelCase__:       List[Any]=True    ,							UpperCamelCase__:       Tuple="reflect"    ,							UpperCamelCase__:       List[Any]=2    ,							UpperCamelCase__:       Dict=2    ,							UpperCamelCase__:       Union[str, Any]=1.0    ,							UpperCamelCase__:       List[str]=1_024    ,							UpperCamelCase__:       int=None    ,							UpperCamelCase__:       str=True    ,							**UpperCamelCase__:       str    ,							):
														lowerCamelCase__      :			Tuple 						= target_bandwidths
														lowerCamelCase__      :			Optional[int] 						= sampling_rate
														lowerCamelCase__      :			Dict 						= audio_channels
														lowerCamelCase__      :			Optional[int] 						= normalize
														lowerCamelCase__      :			Union[str, Any] 						= chunk_length_s
														lowerCamelCase__      :			List[Any] 						= overlap
														lowerCamelCase__      :			str 						= hidden_size
														lowerCamelCase__      :			int 						= num_filters
														lowerCamelCase__      :			Tuple 						= num_residual_layers
														lowerCamelCase__      :			Any 						= upsampling_ratios
														lowerCamelCase__      :			Optional[Any] 						= norm_type
														lowerCamelCase__      :			Optional[Any] 						= kernel_size
														lowerCamelCase__      :			str 						= last_kernel_size
														lowerCamelCase__      :			Any 						= residual_kernel_size
														lowerCamelCase__      :			Union[str, Any] 						= dilation_growth_rate
														lowerCamelCase__      :			Tuple 						= use_causal_conv
														lowerCamelCase__      :			Tuple 						= pad_mode
														lowerCamelCase__      :			int 						= compress
														lowerCamelCase__      :			Tuple 						= num_lstm_layers
														lowerCamelCase__      :			Dict 						= trim_right_ratio
														lowerCamelCase__      :			str 						= codebook_size
														lowerCamelCase__      :			str 						= codebook_dim if codebook_dim is not None else hidden_size
														lowerCamelCase__      :			str 						= use_conv_shortcut

														if self.norm_type not in ["weight_norm", "time_group_norm"]:
																					raise ValueError(
																					    F'''self.norm_type must be one of `\"weight_norm\"`, `\"time_group_norm\"`), got {self.norm_type}'''  )

														super().__init__(**UpperCAmelCase_  )




							@property
							def 	lowerCamelCase_       (							self:       List[Any]  ):



														if self.chunk_length_s is None:
																					return None
														else:
																					return int(self.chunk_length_s * self.sampling_rate  )




							@property
							def 	lowerCamelCase_       (							self:       str  ):



														if self.chunk_length_s is None or self.overlap is None:
																					return None
														else:
																					return max(1    ,							int((1.0 - self.overlap) * self.chunk_length  )  )




							@property
							def 	lowerCamelCase_       (							self:       Any  ):
														lowerCamelCase__      :			Any 						= np.prod(self.upsampling_ratios  )
														return math.ceil(self.sampling_rate / hop_length  )




							@property
							def 	lowerCamelCase_       (							self:       Optional[Any]  ):
														return int(1_000 * self.target_bandwidths[-1] // (self.frame_rate * 10)  )









'''simple docstring'''







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


_A			:    Union[str, Any]					  =logging.get_logger(__name__)

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

class _lowercase			(       _lowercase	):
							a          = """audio-spectrogram-transformer"""




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

														lowerCamelCase__      :			List[Any] 						= hidden_size
														lowerCamelCase__      :			int 						= num_hidden_layers
														lowerCamelCase__      :			List[str] 						= num_attention_heads
														lowerCamelCase__      :			Optional[int] 						= intermediate_size
														lowerCamelCase__      :			List[Any] 						= hidden_act
														lowerCamelCase__      :			List[Any] 						= hidden_dropout_prob
														lowerCamelCase__      :			str 						= attention_probs_dropout_prob
														lowerCamelCase__      :			Dict 						= initializer_range
														lowerCamelCase__      :			List[str] 						= layer_norm_eps
														lowerCamelCase__      :			List[Any] 						= patch_size
														lowerCamelCase__      :			List[str] 						= qkv_bias
														lowerCamelCase__      :			Dict 						= frequency_stride
														lowerCamelCase__      :			List[Any] 						= time_stride
														lowerCamelCase__      :			str 						= max_length
														lowerCamelCase__      :			Dict 						= num_mel_bins

