o
    ß¥µiC  ã                   @   s~   d dl mZmZ d dlmZmZmZ d dlmZ d dl	m
Z
 d dlmZ eƒ Zed Zeeeef ef ZG dd„ deƒZd	S )
é    )ÚABCÚabstractmethod)ÚAnyÚDictÚUnion)ÚModel)Ú
ConfigDict)Ú
get_logger)ztorch.Tensorz	tf.Tensorc                   @   sL   e Zd ZdZdd„ Zedeeef fdd„ƒZ	edeeef fdd„ƒZ
d	S )
ÚHeadzAThe head base class is for the tasks head method definition

    c                 K   s   t |ƒ| _d S )N)r   Úconfig)ÚselfÚkwargs© r   úT/home/ubuntu/.local/lib/python3.10/site-packages/modelscope/models/base/base_head.pyÚ__init__   s   zHead.__init__Úreturnc                 O   ó   dS )zÕ
        This method will use the output from backbone model to do any
        downstream tasks. Receive The output from backbone model.

        Returns (Dict[str, Any]): The output from downstream task.
        Nr   ©r   Úargsr   r   r   r   Úforward   s   zHead.forwardc                 O   r   )zo
        compute loss for head during the finetuning.

        Returns (Dict[str, Any]): The loss dict
        Nr   r   r   r   r   Úcompute_loss!   s   zHead.compute_lossN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   Ústrr   r   r   r   r   r   r   r
      s    	r
   N)Úabcr   r   Útypingr   r   r   Ú!modelscope.models.base.base_modelr   Úmodelscope.utils.configr   Úmodelscope.utils.loggerr	   ÚloggerÚTensorr   ÚInputr
   r   r   r   r   Ú<module>   s   