
    Z j                         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K
JrJr  \	" S	S
9\ " S S\5      5       5       rS/rg)zXcodec model configuration    N)strict   )PreTrainedConfig)auto_docstring   )CONFIG_MAPPING
AutoConfigzManel/X-Codec)
checkpointc                     ^  \ rS rSr% SrSr\\S.rS/ SQS/ SQSS	.r0 r	S
r
\\\-     \\\-  S4   -  \S'   Sr\\S'   Sr\\S'   Sr\\   \\S4   -  \S'   Sr\\   \\S4   -  \S'   Sr\\   \\S4   -  \S'   Sr\\S'   Sr\\S'   Sr\S-  \S'   Sr\\S'   Sr\\-  S-  \S'   Sr\\-  S-  \S'   U 4S jr\S\4S j5       r\S\4S  j5       r \S\4S! j5       r!\S\4S" j5       r"\S\4S# j5       r#\S\4S$ j5       r$S%r%U =r&$ )&XcodecConfig   a  
target_bandwidths (`List[float]`, *optional*, defaults to `[0.5, 1, 1.5, 2, 4]`):
    The range of different bandwidths (in kbps) the model can encode audio with.
channel_ratios (`List[float]`, *optional*, defaults to `[1, 1]`):
    Expansion factors for the number of output channels in each semantic block.
strides (`List[int]`, *optional*, defaults to `[1, 1]`):
    Strides for each semantic encoder block.
block_dilations (`List[int]`, *optional*, defaults to `[1, 1]`):
    Dilation factors for the residual units in semantic blocks.
unit_kernel_size (`int`, *optional*, defaults to 3):
    Kernel size inside each ResidualUnit in semantic blocks.
acoustic_model_config (`Union[Dict, DacConfig]`, *optional*):
    An instance of the configuration for the acoustic (DAC) model.
semantic_model_config (`Union[Dict, HubertConfig, WavLMConfig]`, *optional*):
    An instance of the configuration object for the semantic (HuBERT) model.

Example:

```python
>>> from transformers import XcodecModel, XcodecConfig

>>> # Initializing configuration
>>> configuration = XcodecConfig()

>>> # Initializing a model (with random weights) from the configuration
>>> model = XcodecModel(configuration)

>>> # Accessing the model configuration
>>> configuration = model.config
```xcodec)acoustic_model_configsemantic_model_config@            r         encoder_hidden_sizedownsampling_ratiosdecoder_hidden_sizeupsampling_ratioshidden_size)g      ?   g      ?r   r   .target_bandwidthsi>  sample_rater   kernel_size)r   r   channel_ratiosstridesblock_dilationsunit_kernel_sizecodebook_sizeNcodebook_dimg{Gz?initializer_ranger   r   c                 :  > U R                   c  [        S   " S/ SQS/ SQSS9U l         O[        U R                   [        5      (       ab  U R                   R	                  SS5      U R                   S'   [        U R                   S      " S	0 0 U R
                  EU R                   ED6U l         U R                  c  [        S   " 5       U l        O[        U R                  [        5      (       ab  U R                  R	                  SS5      U R                  S'   [        U R                  S      " S	0 0 U R                  EU R                  ED6U l        U R                  c2  U R                   R                  U R                  R                  -   U l        [        TU ],  " S	0 UD6  g )
Ndacr   r   r   r   r   
model_typehubert )r   r   
isinstancedictget%_default_acoustic_model_config_kwargsr   %_default_semantic_model_config_kwargsr'   r   super__post_init__)selfkwargs	__class__s     ڀ/root/GenerationalWealth/GenerationalWealth/venv/lib/python3.13/site-packages/transformers/models/xcodec/configuration_xcodec.pyr4   XcodecConfig.__post_init__\   s}   %%-)7)>$& %1$(".*D& 22D997;7Q7Q7U7UVbdi7jD&&|4)78R8RS_8`)a *^T??^4C]C]^*D& %%-)7)A)CD&22D997;7Q7Q7U7UVbdl7mD&&|4)78R8RS_8`)a *^T??^4C]C]^*D& $ $ : : F FIcIcIoIo oD''    returnc                 \    [         R                  " U R                  U R                  -  5      $ N)mathceilr    
hop_lengthr5   s    r8   
frame_rateXcodecConfig.frame_ratez   s     yy))DOO;<<r:   c                 .    U R                   R                  $ r=   )r   r   rA   s    r8   semantic_hidden_size!XcodecConfig.semantic_hidden_size~   s    ))555r:   c                 h    [        [        R                  " U R                  R                  5      5      $ r=   )intnpprodr   r   rA   s    r8   r@   XcodecConfig.hop_length   s"    277455IIJKKr:   c                 j    [         R                  " [         R                  " U R                  5      5      $ r=   )r>   r?   log2r&   rA   s    r8   codebook_nbitsXcodecConfig.codebook_nbits   s     yy4#5#5677r:   c                 \    U R                   R                  U R                  R                  -   $ r=   )r   r   r   rA   s    r8   r   XcodecConfig.hidden_size   s%    ))558R8R8^8^^^r:   c                 l    [        SU R                  S   -  U R                  U R                  -  -  5      $ )Ni  )rH   r   rB   rN   rA   s    r8   num_quantizersXcodecConfig.num_quantizers   s1    4$00444K^K^9^_``r:   )r   r'   r   )'__name__
__module____qualname____firstlineno____doc__r+   r	   sub_configsr1   r2   r   listrH   floattuple__annotations__r    r!   r"   r#   r$   r%   r&   r'   r(   r   r/   r   r   r4   propertyrB   rE   r@   rN   r   rT   __static_attributes____classcell__)r7   s   @r8   r   r      s   > J ",!+K  "  ,#)-) -/)EXtC%K(5uc1A+BBXKK28NDIc3h/8+1GT#YsCx(139OT#YsCx09cM3#L#*##u#<@4"22T9@<@4"22T9@(< =C = = 6c 6 6 LC L L 8 8 8 _S _ _ a a ar:   r   )rZ   r>   numpyrI   huggingface_hub.dataclassesr   configuration_utilsr   utilsr   autor   r	   r   __all__r-   r:   r8   <module>ri      sV    !   . 3 # - ?+ta# ta  ,tan 
r:   