Ë
    ©sgË  ã                   ój   — d Z ddlZddlZddlmZ ddlmZ  ej                  e	«      Z
 G d„ de«      Zy)zDac model configurationé    Né   )ÚPretrainedConfig)Úloggingc            
       óV   ‡ — e Zd ZdZdZdg d¢ddddd	d
ddf
ˆ fd„	Zedefd„«       Zˆ xZ	S )Ú	DacConfigaW	  
    This is the configuration class to store the configuration of an [`DacModel`]. It is used to instantiate a
    Dac model according to the specified arguments, defining the model architecture. Instantiating a configuration
    with the defaults will yield a similar configuration to that of the
    [descript/dac_16khz](https://huggingface.co/descript/dac_16khz) architecture.

    Configuration objects inherit from [`PretrainedConfig`] and can be used to control the model outputs. Read the
    documentation from [`PretrainedConfig`] for more information.

    Args:
        encoder_hidden_size (`int`, *optional*, defaults to 64):
            Intermediate representation dimension for the encoder.
        downsampling_ratios (`List[int]`, *optional*, defaults to `[2, 4, 8, 8]`):
            Ratios for downsampling in the encoder. These are used in reverse order for upsampling in the decoder.
        decoder_hidden_size (`int`, *optional*, defaults to 1536):
            Intermediate representation dimension for the decoder.
        n_codebooks (`int`, *optional*, defaults to 9):
            Number of codebooks in the VQVAE.
        codebook_size (`int`, *optional*, defaults to 1024):
            Number of discrete codes in each codebook.
        codebook_dim (`int`, *optional*, defaults to 8):
            Dimension of the codebook vectors. If not defined, uses `encoder_hidden_size`.
        quantizer_dropout (`bool`, *optional*, defaults to 0):
            Whether to apply dropout to the quantizer.
        commitment_loss_weight (float, *optional*, defaults to 0.25):
            Weight of the commitment loss term in the VQVAE loss function.
        codebook_loss_weight (float, *optional*, defaults to 1.0):
            Weight of the codebook loss term in the VQVAE loss function.
        sampling_rate (`int`, *optional*, defaults to 16000):
            The sampling rate at which the audio waveform should be digitalized expressed in hertz (Hz).
    Example:

    ```python
    >>> from transformers import DacModel, DacConfig

    >>> # Initializing a "descript/dac_16khz" style configuration
    >>> configuration = DacConfig()

    >>> # Initializing a model (with random weights) from the "descript/dac_16khz" style configuration
    >>> model = DacModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```Údacé@   )é   é   é   r   i   é	   i   r   r   g      Ð?g      ð?i€>  c                 ó<  •— || _         || _        || _        |d d d…   | _        || _        || _        || _        || _        |
| _        |dt        |«      z  z  | _
        t        t        j                  |«      «      | _        || _        |	| _        t#        ‰| H  di |¤Ž y )Néÿÿÿÿr
   © )Úencoder_hidden_sizeÚdownsampling_ratiosÚdecoder_hidden_sizeÚupsampling_ratiosÚn_codebooksÚcodebook_sizeÚcodebook_dimÚquantizer_dropoutÚsampling_rateÚlenÚhidden_sizeÚintÚnpÚprodÚ
hop_lengthÚcommitment_loss_weightÚcodebook_loss_weightÚsuperÚ__init__)Úselfr   r   r   r   r   r   r   r    r!   r   ÚkwargsÚ	__class__s               €ú\/var/www/html/venv/lib/python3.12/site-packages/transformers/models/dac/configuration_dac.pyr#   zDacConfig.__init__L   s¤   ø€ ð $7ˆÔ Ø#6ˆÔ Ø#6ˆÔ Ø!4±T°r°TÑ!:ˆÔØ&ˆÔØ*ˆÔØ(ˆÔØ!2ˆÔØ*ˆÔà.°!´sÐ;NÓ7OÑ2OÑPˆÔäœbŸg™gÐ&9Ó:Ó;ˆŒØ&<ˆÔ#Ø$8ˆÔ!ä‰ÑÑ"˜6Ó"ó    Úreturnc                 ó„   — t        j                  | j                  «      }t        j                  | j
                  |z  «      S )N)r   r   r   ÚmathÚceilr   )r$   r   s     r'   Ú
frame_ratezDacConfig.frame_ratel   s0   € ä—W‘W˜T×3Ñ3Ó4ˆ
Üy‰y˜×+Ñ+¨jÑ8Ó9Ð9r(   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typer#   Úpropertyr   r-   Ú__classcell__)r&   s   @r'   r   r      sQ   ø„ ñ+ðZ €Jð Ú(Ø ØØØØØ#Ø Øõ#ð@ ð:˜Cò :ó ô:r(   r   )r1   r+   Únumpyr   Úconfiguration_utilsr   Úutilsr   Ú
get_loggerr.   Úloggerr   r   r(   r'   ú<module>r:      s9   ðñ ã ã å 3Ý ð 
ˆ×	Ñ	˜HÓ	%€ôS:Ð õ S:r(   