o
    i                     @   sF   d Z ddlmZ ddlmZ G dd deZdddd	iZd
d ZdS )zST Interface module.    )ASRInterface)dynamic_importc                   @   s*   e Zd ZdZddg fddZdddZdS )STInterfacezST Interface for ESPnet model implementation.

    NOTE: This class is inherited from ASRInterface to enable joint translation
    and recognition when performing multi-task learning with the ASR task.

    Nc                 C      t d)aa  Recognize x for evaluation.

        :param ndarray x: input acouctic feature (B, T, D) or (T, D)
        :param namespace trans_args: argment namespace contraining options
        :param list char_list: list of characters
        :param torch.nn.Module rnnlm: language model module
        :return: N-best decoding results
        :rtype: list
        z#translate method is not implementedNotImplementedError)selfx
trans_args	char_listrnnlmensemble_models r   L/home/ubuntu/.local/lib/python3.10/site-packages/espnet/nets/st_interface.py	translate      
zSTInterface.translatec                 C   r   )at  Beam search implementation for batch.

        :param torch.Tensor x: encoder hidden state sequences (B, Tmax, Henc)
        :param namespace trans_args: argument namespace containing options
        :param list char_list: list of characters
        :param torch.nn.Module rnnlm: language model module
        :return: N-best decoding results
        :rtype: list
        z$Batch decoding is not supported yet.r   )r   r	   r
   r   r   r   r   r   translate_batch   r   zSTInterface.translate_batch)NN)__name__
__module____qualname____doc__r   r   r   r   r   r   r      s    r   pytorchz&espnet.nets.pytorch_backend.e2e_st:E2Ez2espnet.nets.pytorch_backend.e2e_st_transformer:E2E)rnntransformerc                 C   s0   t | t|t }t|tsJ |  d|S )zImport ST models dynamically.

    Args:
        module (str): module_name:class_name or alias in `predefined_st`
        backend (str): NN backend. e.g., pytorch, chainer

    Returns:
        type: ST class

    z does not implement STInterface)r   predefined_stgetdict
issubclassr   )modulebackendmodel_classr   r   r   dynamic_import_st4   s   r!   N)r   espnet.nets.asr_interfacer   espnet.utils.dynamic_importr   r   r   r!   r   r   r   r   <module>   s    "