

"""simple docstring"""


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


__A		  =     logging.get_logger(__name__)

__A		  =     {
    "microsoft/cvt-13": "https://huggingface.co/microsoft/cvt-13/resolve/main/config.json",
    # See all Cvt models at https://huggingface.co/models?filter=cvt
}





class        snake_case      (							__a    ):
				SCREAMING_SNAKE_CASE_  : str   =    '''cvt'''

				def __init__(      self				:							Union[str, Any]	,    UpperCamelCase__				:							Union[str, Any]=3	,    UpperCamelCase__				:							List[Any]=[7, 3, 3]	,    UpperCamelCase__				:							str=[4, 2, 2]	,    UpperCamelCase__				:							Tuple=[2, 1, 1]	,    UpperCamelCase__				:							Dict=[6_4, 1_9_2, 3_8_4]	,    UpperCamelCase__				:							int=[1, 3, 6]	,    UpperCamelCase__				:							Optional[Any]=[1, 2, 1_0]	,    UpperCamelCase__				:							Tuple=[4.0, 4.0, 4.0]	,    UpperCamelCase__				:							Tuple=[0.0, 0.0, 0.0]	,    UpperCamelCase__				:							Tuple=[0.0, 0.0, 0.0]	,    UpperCamelCase__				:							Dict=[0.0, 0.0, 0.1]	,    UpperCamelCase__				:							List[str]=[True, True, True]	,    UpperCamelCase__				:							Optional[Any]=[False, False, True]	,    UpperCamelCase__				:							Optional[int]=["dw_bn", "dw_bn", "dw_bn"]	,    UpperCamelCase__				:							List[Any]=[3, 3, 3]	,    UpperCamelCase__				:							List[Any]=[1, 1, 1]	,    UpperCamelCase__				:							int=[2, 2, 2]	,    UpperCamelCase__				:							Union[str, Any]=[1, 1, 1]	,    UpperCamelCase__				:							List[str]=[1, 1, 1]	,    UpperCamelCase__				:							List[Any]=0.02	,    UpperCamelCase__				:							str=1e-12	,    **UpperCamelCase__				:							Dict	,    )->  List[Any]:



						'''simple docstring'''


						super().__init__(**__UpperCamelCase)
						__lowerCAmelCase:			Optional[Any]        =     num_channels
						__lowerCAmelCase:			Optional[int]        =     patch_sizes
						__lowerCAmelCase:			Optional[int]        =     patch_stride
						__lowerCAmelCase:			str        =     patch_padding
						__lowerCAmelCase:			List[Any]        =     embed_dim
						__lowerCAmelCase:			str        =     num_heads
						__lowerCAmelCase:			Any        =     depth
						__lowerCAmelCase:			List[Any]        =     mlp_ratio
						__lowerCAmelCase:			int        =     attention_drop_rate
						__lowerCAmelCase:			List[Any]        =     drop_rate
						__lowerCAmelCase:			Optional[int]        =     drop_path_rate
						__lowerCAmelCase:			int        =     qkv_bias
						__lowerCAmelCase:			Optional[int]        =     cls_token
						__lowerCAmelCase:			Optional[Any]        =     qkv_projection_method
						__lowerCAmelCase:			int        =     kernel_qkv
						__lowerCAmelCase:			Any        =     padding_kv
						__lowerCAmelCase:			Union[str, Any]        =     stride_kv
						__lowerCAmelCase:			List[str]        =     padding_q
						__lowerCAmelCase:			Any        =     stride_q
						__lowerCAmelCase:			Optional[int]        =     initializer_range
						__lowerCAmelCase:			int        =     layer_norm_eps



import math
from typing import Optional

import numpy as np

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


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

SCREAMING_SNAKE_CASE		:     Tuple         =	{
    "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        UpperCamelCase						(				__a				):
						a__		:int      =			'''encodec'''





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





						@property
						def        A_							(self						)				->				Optional[int]:
												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        A_							(self						)				->				int:
												UpperCamelCase_		:							int  =		np.prod(self.upsampling_ratios						)
												return math.ceil(self.sampling_rate / hop_length						)





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






