U
    5A·fH  ã                   @   s:   d Z ddlmZ ddlmZ e e¡ZG dd„ deƒZdS )z UnivNetModel model configurationé   )ÚPretrainedConfig)Úloggingc                       sh   e Zd ZdZdZddddddgdddgd	dd
dgd	dd
dgd	dd
dggddddddf‡ fdd„	Z‡  ZS )ÚUnivNetConfiga  
    This is the configuration class to store the configuration of a [`UnivNetModel`]. It is used to instantiate a
    UnivNet vocoder 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 UnivNet
    [dg845/univnet-dev](https://huggingface.co/dg845/univnet-dev) architecture, which corresponds to the 'c32'
    architecture in [maum-ai/univnet](https://github.com/maum-ai/univnet/blob/master/config/default_c32.yaml).

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

    Args:
        model_in_channels (`int`, *optional*, defaults to 64):
            The number of input channels for the UnivNet residual network. This should correspond to
            `noise_sequence.shape[1]` and the value used in the [`UnivNetFeatureExtractor`] class.
        model_hidden_channels (`int`, *optional*, defaults to 32):
            The number of hidden channels of each residual block in the UnivNet residual network.
        num_mel_bins (`int`, *optional*, defaults to 100):
            The number of frequency bins in the conditioning log-mel spectrogram. This should correspond to the value
            used in the [`UnivNetFeatureExtractor`] class.
        resblock_kernel_sizes (`Tuple[int]` or `List[int]`, *optional*, defaults to `[3, 3, 3]`):
            A tuple of integers defining the kernel sizes of the 1D convolutional layers in the UnivNet residual
            network. The length of `resblock_kernel_sizes` defines the number of resnet blocks and should match that of
            `resblock_stride_sizes` and `resblock_dilation_sizes`.
        resblock_stride_sizes (`Tuple[int]` or `List[int]`, *optional*, defaults to `[8, 8, 4]`):
            A tuple of integers defining the stride sizes of the 1D convolutional layers in the UnivNet residual
            network. The length of `resblock_stride_sizes` should match that of `resblock_kernel_sizes` and
            `resblock_dilation_sizes`.
        resblock_dilation_sizes (`Tuple[Tuple[int]]` or `List[List[int]]`, *optional*, defaults to `[[1, 3, 9, 27], [1, 3, 9, 27], [1, 3, 9, 27]]`):
            A nested tuple of integers defining the dilation rates of the dilated 1D convolutional layers in the
            UnivNet residual network. The length of `resblock_dilation_sizes` should match that of
            `resblock_kernel_sizes` and `resblock_stride_sizes`. The length of each nested list in
            `resblock_dilation_sizes` defines the number of convolutional layers per resnet block.
        kernel_predictor_num_blocks (`int`, *optional*, defaults to 3):
            The number of residual blocks in the kernel predictor network, which calculates the kernel and bias for
            each location variable convolution layer in the UnivNet residual network.
        kernel_predictor_hidden_channels (`int`, *optional*, defaults to 64):
            The number of hidden channels for each residual block in the kernel predictor network.
        kernel_predictor_conv_size (`int`, *optional*, defaults to 3):
            The kernel size of each 1D convolutional layer in the kernel predictor network.
        kernel_predictor_dropout (`float`, *optional*, defaults to 0.0):
            The dropout probability for each residual block in the kernel predictor network.
        initializer_range (`float`, *optional*, defaults to 0.01):
            The standard deviation of the truncated_normal_initializer for initializing all weight matrices.
        leaky_relu_slope (`float`, *optional*, defaults to 0.2):
            The angle of the negative slope used by the leaky ReLU activation.

    Example:

    ```python
    >>> from transformers import UnivNetModel, UnivNetConfig

    >>> # Initializing a Tortoise TTS style configuration
    >>> configuration = UnivNetConfig()

    >>> # Initializing a model (with random weights) from the Tortoise TTS style configuration
    >>> model = UnivNetModel(configuration)

    >>> # Accessing the model configuration
    >>> configuration = model.config
    ```
    Zunivneté@   é    éd   r   é   é   é   é	   é   g        g{®Gáz„?gš™™™™™É?c                    s„   t |ƒt |ƒ  kr t |ƒks*n tdƒ‚|| _|| _|| _|| _|| _|| _|| _|| _	|	| _
|
| _|| _|| _tƒ jf |Ž d S )Nz§`resblock_kernel_sizes`, `resblock_stride_sizes`, and `resblock_dilation_sizes` must all have the same length (which will be the number of resnet blocks in the model).)ÚlenÚ
ValueErrorÚmodel_in_channelsÚmodel_hidden_channelsÚnum_mel_binsÚresblock_kernel_sizesÚresblock_stride_sizesÚresblock_dilation_sizesÚkernel_predictor_num_blocksÚ kernel_predictor_hidden_channelsÚkernel_predictor_conv_sizeÚkernel_predictor_dropoutÚinitializer_rangeÚleaky_relu_slopeÚsuperÚ__init__)Úselfr   r   r   r   r   r   r   r   r   r   r   r   Úkwargs©Ú	__class__© úU/tmp/pip-unpacked-wheel-zw5xktn0/transformers/models/univnet/configuration_univnet.pyr   X   s"    "ÿzUnivNetConfig.__init__)Ú__name__Ú
__module__Ú__qualname__Ú__doc__Z
model_typer   Ú__classcell__r!   r!   r   r"   r      s   > ór   N)	r&   Zconfiguration_utilsr   Úutilsr   Z
get_loggerr#   Úloggerr   r!   r!   r!   r"   Ú<module>   s   
