o
    
j                     @   sL   d dl mZ d dlmZ d dlZd dlmZ d dlmZ G dd deZ	dS )    )abstractmethod)DictN)Coqpit)TrainerModelc                   @   sh   e Zd ZdZeedefddZei fdej	de
fddZe		ddededededdf
ddZdS )BaseTrainerModelu   BaseTrainerModel model expanding TrainerModel with required functions by 🐸TTS.

    Every new 🐸TTS model must inherit it.
    configc                 C      dS )zuInit the model and all its attributes from the given config.

        Override this depending on your model.
        N )r   r	   r	   </home/kuhnn/.local/lib/python3.10/site-packages/TTS/model.pyinit_from_config   s   z!BaseTrainerModel.init_from_configinputreturnc                 C   s   ddi}	 |S )a  Forward pass for inference.

        It must return a dictionary with the main model output and all the auxiliary outputs. The key ```model_outputs```
        is considered to be the main output and you can add any other auxiliary outputs as you want.

        We don't use `*kwargs` since it is problematic with the TorchScript API.

        Args:
            input (torch.Tensor): [description]
            aux_input (Dict): Auxiliary inputs like speaker embeddings, durations etc.

        Returns:
            Dict: [description]
        model_outputsNr	   )selfr   	aux_inputoutputs_dictr	   r	   r
   	inference   s   zBaseTrainerModel.inferenceFTcheckpoint_pathevalstrictNc                 C   r   )aC  Load a model checkpoint gile and get ready for training or inference.

        Args:
            config (Coqpit): Model configuration.
            checkpoint_path (str): Path to the model checkpoint file.
            eval (bool, optional): If true, init model for inference else for training. Defaults to False.
            strict (bool, optional): Match all checkpoint keys to model's keys. Defaults to True.
            cache (bool, optional): If True, cache the file locally for subsequent calls. It is cached under `get_user_data_dir()/tts_cache`. Defaults to False.
        Nr	   )r   r   r   r   r   cacher	   r	   r
   load_checkpoint.   s   z BaseTrainerModel.load_checkpoint)FTF)__name__
__module____qualname____doc__staticmethodr   r   r   torchTensorr   r   strboolr   r	   r	   r	   r
   r      s(    r   )
abcr   typingr   r   coqpitr   trainerr   r   r	   r	   r	   r
   <module>   s    