
    Z j                     t    S r SSKrSSKrSSKJr  SSKJr  SSKJ	r	  \	" SS9\ " S	 S
\5      5       5       r
S
/rg)zEnCodec model configuration    N)strict   )PreTrainedConfig)auto_docstringzfacebook/encodec_24khz)
checkpointc                   Z  ^  \ rS rSr% SrSrSr\\   \	\S4   -  \
S'   Sr\\
S'   S	r\\
S
'   Sr\\
S'   Sr\\-  S-  \
S'   Sr\S-  \
S'   Sr\\
S'   Sr\\
S'   S	r\\
S'   Sr\\   \	\S4   -  \
S'   Sr\\
S'   Sr\\
S'   Sr\\
S'   Sr\\
S'   Sr\\
S'   S r\\
S!'   S"r\\
S#'   Sr\\
S$'   Sr\\
S%'   S&r \\
S''   S(r!\\
S)'   Sr"\S-  \
S*'   S r#\\
S+'   U 4S, jr$S- r%\&S.\S-  4S/ j5       r'\&S.\S-  4S0 j5       r(\&S.\4S1 j5       r)\&S.\4S2 j5       r*\&S.\4S3 j5       r+\&S.\4S4 j5       r,S5r-U =r.$ )6EncodecConfig   a  
target_bandwidths (`list[float]`, *optional*, defaults to `[1.5, 3.0, 6.0, 12.0, 24.0]`):
    The range of different bandwidths the model can encode audio with.
normalize (`bool`, *optional*, defaults to `False`):
    Whether the audio shall be normalized when passed.
chunk_length_s (`float`, *optional*):
    If defined the audio is pre-processed into chunks of lengths `chunk_length_s` and then encoded.
overlap (`float`, *optional*):
    Defines the overlap between each chunk. It is used to compute the `chunk_stride` using the following
    formulae : `int((1.0 - self.overlap) * self.chunk_length)`.
num_filters (`int`, *optional*, defaults to 32):
    Number of convolution kernels of first `EncodecConv1d` down sampling layer.
num_residual_layers (`int`,  *optional*, defaults to 1):
    Number of residual layers.
upsampling_ratios (`Sequence[int]` , *optional*, defaults to `[8, 5, 4, 2]`):
    Kernel size and stride ratios. The encoder uses downsampling ratios instead of upsampling ratios, hence it
    will use the ratios in the reverse order to the ones specified here that must match the decoder order.
norm_type (`str`, *optional*, defaults to `"weight_norm"`):
    Normalization method. Should be in `["weight_norm", "time_group_norm"]`
kernel_size (`int`, *optional*, defaults to 7):
    Kernel size for the initial convolution.
last_kernel_size (`int`, *optional*, defaults to 7):
    Kernel size for the last convolution layer.
residual_kernel_size (`int`, *optional*, defaults to 3):
    Kernel size for the residual layers.
dilation_growth_rate (`int`, *optional*, defaults to 2):
    How much to increase the dilation with each layer.
use_causal_conv (`bool`, *optional*, defaults to `True`):
    Whether to use fully causal convolution.
pad_mode (`str`, *optional*, defaults to `"reflect"`):
    Padding mode for the convolutions.
compress (`int`, *optional*, defaults to 2):
    Reduced dimensionality in residual branches (from Demucs v3).
num_lstm_layers (`int`, *optional*, defaults to 2):
    Number of LSTM layers at the end of the encoder.
trim_right_ratio (`float`, *optional*, defaults to 1.0):
    Ratio for trimming at the right of the transposed convolution under the `use_causal_conv = True` setup. If
    equal to 1.0, it means that all the trimming is done at the right.
use_conv_shortcut (`bool`, *optional*, defaults to `True`):
    Whether to use a convolutional layer as the 'skip' connection in the `EncodecResnetBlock` block. If False,
    an identity function will be used, giving a generic residual connection.

Example:

```python
>>> from transformers import EncodecModel, EncodecConfig

>>> # Initializing a "facebook/encodec_24khz" style configuration
>>> configuration = EncodecConfig()

>>> # Initializing a model (with random weights) from the "facebook/encodec_24khz" style configuration
>>> model = EncodecModel(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```encodec)g      ?g      @g      @g      (@g      8@.target_bandwidthsi]  sampling_rate   audio_channelsF	normalizeNchunk_length_soverlap   hidden_size    num_filtersnum_residual_layers)            upsampling_ratiosweight_norm	norm_type   kernel_sizelast_kernel_sizer   residual_kernel_sizer   dilation_growth_rateTuse_causal_convreflectpad_modecompressnum_lstm_layers      ?trim_right_ratioi   codebook_sizecodebook_dimuse_conv_shortcutc                 z   > U R                   b  U R                   OU R                  U l         [        TU ]  " S0 UD6  g )N )r,   r   super__post_init__)selfkwargs	__class__s     ڂ/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/transformers/models/encodec/configuration_encodec.pyr1   EncodecConfig.__post_init__o   s5    151B1B1ND--TXTdTd''    c                 T    U R                   S;  a  [        SU R                    35      eg)zOPart of `@strict`-powered validation. Validates the architecture of the config.)r   time_group_normzIself.norm_type must be one of `"weight_norm"`, `"time_group_norm"`), got N)r   
ValueErrorr2   s    r5   validate_architecture#EncodecConfig.validate_architectures   s4    >>!CC[\`\j\j[kl  Dr7   returnc                 b    U R                   c  g [        U R                   U R                  -  5      $ N)r   intr   r;   s    r5   chunk_lengthEncodecConfig.chunk_length{   s-    &t**T-?-??@@r7   c                     U R                   b  U R                  c  g [        S[        SU R                  -
  U R                  -  5      5      $ )Nr   r)   )r   r   maxrA   rB   r;   s    r5   chunk_strideEncodecConfig.chunk_stride   s@    &$,,*>q#sT\\1T5F5FFGHHr7   c                 T    [        [        R                  " U R                  5      5      $ r@   )rA   npprodr   r;   s    r5   
hop_lengthEncodecConfig.hop_length   s    277411233r7   c                 j    [         R                  " [         R                  " U R                  5      5      $ r@   )mathceillog2r+   r;   s    r5   codebook_nbitsEncodecConfig.codebook_nbits   s     yy4#5#5677r7   c                 \    [         R                  " U R                  U R                  -  5      $ r@   )rN   rO   r   rK   r;   s    r5   
frame_rateEncodecConfig.frame_rate   s     yy++doo=>>r7   c                 l    [        SU R                  S   -  U R                  U R                  -  -  5      $ )Ni  )rA   r   rT   rQ   r;   s    r5   num_quantizersEncodecConfig.num_quantizers   s1    4$00444K^K^9^_``r7   )r,   )/__name__
__module____qualname____firstlineno____doc__
model_typer   listfloattuple__annotations__r   rA   r   r   boolr   r   r   r   r   r   r   strr    r!   r"   r#   r$   r&   r'   r(   r*   r+   r,   r-   r1   r<   propertyrB   rF   rK   rQ   rT   rX   __static_attributes____classcell__)r4   s   @r5   r	   r	      s   7r J9TtE{U5#:%66TM3NCIt)-NC%K$&- GUT\ KK  5AtCy5c?2A"Is"Kc !#! !#! OT HcHcOS!e!M3#L#*#"t"( AcDj A A IcDj I I 4C 4 4 8 8 8 ?C ? ? a a ar7   r	   )r^   rN   numpyrI   huggingface_hub.dataclassesr   configuration_utilsr   utilsr   r	   __all__r/   r7   r5   <module>rn      sT    "   . 3 # 34}a$ }a  5}a@ 
r7   