o
    ¡¿¯iV  ã                   @   sB   d dl mZmZ d dlmZmZ d dlZG dd„ dejjeƒZ	dS )é    )ÚABCÚabstractmethod)ÚDictÚTupleNc                	   @   sb   e Zd ZdZedejdeejee	ejf ejf fdd„ƒZ
edejdee	ejf fdd„ƒZdS )	ÚAbsESPnetModela•  The common abstract class among each tasks

    "ESPnetModel" is referred to a class which inherits torch.nn.Module,
    and makes the dnn-models forward as its member field,
    a.k.a delegate pattern,
    and defines "loss", "stats", and "weight" for the task.

    If you intend to implement new task in ESPNet,
    the model must inherit this class.
    In other words, the "mediator" objects between
    our training system and the your task class are
    just only these three values, loss, stats, and weight.

    Example:
        >>> from espnet2.tasks.abs_task import AbsTask
        >>> class YourESPnetModel(AbsESPnetModel):
        ...     def forward(self, input, input_lengths):
        ...         ...
        ...         return loss, stats, weight
        >>> class YourTask(AbsTask):
        ...     @classmethod
        ...     def build_model(cls, args: argparse.Namespace) -> YourESPnetModel:
    ÚbatchÚreturnc                 K   ó   t ‚©N©ÚNotImplementedError©Úselfr   © r   úR/home/ubuntu/.local/lib/python3.10/site-packages/espnet2/train/abs_espnet_model.pyÚforward    s   zAbsESPnetModel.forwardc                 K   r	   r
   r   r   r   r   r   Úcollect_feats&   s   zAbsESPnetModel.collect_featsN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   ÚtorchÚTensorr   r   Ústrr   r   r   r   r   r   r      s    ÿþ$r   )
Úabcr   r   Útypingr   r   r   ÚnnÚModuler   r   r   r   r   Ú<module>   s    