o
    €wÖiå  ã                   @   sP   d Z ddlZddlZddlmZ ddlmZ e e	¡Z
G dd„ deƒZdgZdS )zDac model configurationé    Né   )ÚPretrainedConfig)Úloggingc                
       sP   e Zd ZdZdZdg d¢ddddd	d
ddf
‡ fdd„	Zedefdd„ƒZ‡  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                    s„   || _ || _|| _|d d d… | _|| _|| _|| _|| _|
| _|dt	|ƒ  | _
tt |¡ƒ| _|| _|	| _tƒ jdi |¤Ž d S )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__r   úf/home/ubuntu/sommelier/.venv/lib/python3.10/site-packages/transformers/models/dac/configuration_dac.pyr    L   s   zDacConfig.__init__Úreturnc                 C   s   t  | j¡}t | j| ¡S )N)r   r   r   ÚmathÚceilr   )r!   r   r   r   r%   Ú
frame_ratel   s   zDacConfig.frame_rate)
Ú__name__Ú
__module__Ú__qualname__Ú__doc__Ú
model_typer    Úpropertyr   r)   Ú__classcell__r   r   r#   r%   r      s     -õ r   )r-   r'   Únumpyr   Úconfiguration_utilsr   Úutilsr   Ú
get_loggerr*   Úloggerr   Ú__all__r   r   r   r%   Ú<module>   s   

V