
    g                     n    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dS )zDac model configuration    N   )PretrainedConfig)loggingc            
       \     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                 f   || _         || _        || _        |d d d         | _        || _        || _        || _        || _        |
| _        |dt          |          z  z  | _
        t          t          j        |                    | _        || _        |	| _         t#                      j        di | d S )Nr
    )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               e/var/www/html/ai-engine/env/lib/python3.11/site-packages/transformers/models/dac/configuration_dac.pyr#   zDacConfig.__init__L   s     $7 #6 #6 !4TTrT!:&*(!2*.!s;N7O7O2OPbg&9::;;&<#$8!""6"""""    returnc                 l    t          j        | j                  }t          j        | j        |z            S )N)r   r   r   mathceilr   )r$   r   s     r'   
frame_ratezDacConfig.frame_ratel   s,    WT344
y+j8999r(   )
__name__
__module____qualname____doc__
model_typer#   propertyr   r-   __classcell__)r&   s   @r'   r   r      s        + +Z J (LL # # # # # # #@ :C : : : X: : : : :r(   r   )r1   r+   numpyr   configuration_utilsr   utilsr   
get_loggerr.   loggerr   r   r(   r'   <module>r:      s           3 3 3 3 3 3       
	H	%	%S: S: S: S: S:  S: S: S: S: S:r(   