


'''simple docstring'''





import math
from typing import Optional

import numpy as np

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


UpperCAmelCase__  			=				logging.get_logger(__name__)

UpperCAmelCase__  			=				{
    '''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 						a__					(					a_   ):





			'''simple docstring'''

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

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







'''simple docstring'''





def 						UpperCAmelCase__(				_SCREAMING_SNAKE_CASE					: int,_SCREAMING_SNAKE_CASE					: int,_SCREAMING_SNAKE_CASE					: int ):






			"""simple docstring"""




			if exponent == 1:
						return base
			if exponent % 2 == 0:
						__A=	_modexpt(_SCREAMING_SNAKE_CASE,exponent // 2,_SCREAMING_SNAKE_CASE ) % modulo_value
						return (x * x) % modulo_value
			else:
						return (base * _modexpt(_SCREAMING_SNAKE_CASE,exponent - 1,_SCREAMING_SNAKE_CASE )) % modulo_value






def 						UpperCAmelCase__(				_SCREAMING_SNAKE_CASE					: int = 1777,_SCREAMING_SNAKE_CASE					: int = 1855,_SCREAMING_SNAKE_CASE					: int = 8 ):






			"""simple docstring"""




			__A=	base
			for _ in range(1,_SCREAMING_SNAKE_CASE ):
						__A=	_modexpt(_SCREAMING_SNAKE_CASE,_SCREAMING_SNAKE_CASE,10**digits )

			return result


if __name__ == "__main__":
					print(F"""{solution() = }""")



