o
    ´‹
já  ã                   @   s,   d dl mZ d dlmZ G dd„ deƒZdS )é    )ÚCoqpit)ÚBaseTrainerModelc                       s2   e Zd ZdZdZ‡ fdd„Zdefdd„Z‡  ZS )ÚBaseVocoderal  Base `vocoder` class. Every new `vocoder` model must inherit this.

    It defines `vocoder` specific functions on top of `Model`.

    Notes on input/output tensor shapes:
        Any input or output tensor of the model must be shaped as

        - 3D tensors `batch x time x channels`
        - 2D tensors `batch x channels`
        - 1D tensors `batch x 1`
    Úvocoderc                    s   t ƒ  ¡  |  |¡ d S )N)ÚsuperÚ__init__Ú_set_model_args)ÚselfÚconfig©Ú	__class__© úR/home/kuhnn/.local/lib/python3.10/site-packages/TTS/vocoder/models/base_vocoder.pyr      s   
zBaseVocoder.__init__r
   c                 C   s¬   d|j jv rRd|v r9|  |¡\}| _}|| j_t| jdƒr5||j_d|v r*| jj| _d|v r7| jj| _dS dS dS || _d|v rE| jj| _d|v rP| jj| _dS dS t	dƒ‚)a  Setup model args based on the config type.

        If the config is for training with a name like "*Config", then the model args are embeded in the
        config.model_args

        If the config is for the model with a name like "*Args", then we assign the directly.
        ÚConfigÚ
charactersÚ
model_argsÚmodel_paramsz(config must be either a *Config or *ArgsN)
r   Ú__name__Úget_charactersr
   Ú	num_charsÚhasattrr   Úargsr   Ú
ValueError)r	   r
   Ú_r   r   r   r   r      s&   	
ú
ÿzBaseVocoder._set_model_args)	r   Ú
__module__Ú__qualname__Ú__doc__Ú
MODEL_TYPEr   r   r   Ú__classcell__r   r   r   r   r      s
    r   N)Úcoqpitr   Ú	TTS.modelr   r   r   r   r   r   Ú<module>   s    