§
    u”j®  ã                   ó>   — d dl mZmZ d dlmZ  G d„ de¦  «        ZdS )é    )ÚABCÚabstractmethod)ÚDictc                   óf   — e Zd ZdZd„ Zededefd„¦   «         Zed„ ¦   «         Zed
d„¦   «         Z	d	S )ÚMetriczÙThe metric base class for computing metrics.

    The subclasses can either compute a single metric like 'accuracy', or compute the
    complex metrics for a specific task with or without other Metric subclasses.
    c                 ó   — d S )N© )ÚselfÚargsÚkwargss      úg/lsinfo/ai/hellotax_ai/data_center/backend/venv/lib/python3.11/site-packages/modelscope/metrics/base.pyÚ__init__zMetric.__init__   s   € Øˆó    ÚoutputsÚinputsc                 ó   — dS )a3   Append logits and labels within an eval loop.

        Will be called after every batch finished to gather the model predictions and the labels.

        Args:
            outputs: The model prediction outputs.
            inputs: The mini batch inputs from the dataloader.

        Returns: None

        Nr	   )r
   r   r   s      r   Úaddz
Metric.add   s	   € ð 	ˆr   c                 ó   — dS )z²Evaluate the metrics after the eval finished.

        Will be called after the whole validation finished.

        Returns: The actual metric dict with standard names.

        Nr	   )r
   s    r   ÚevaluatezMetric.evaluate   s	   € ð 	ˆr   Úotherc                 ó   — dS )a*   When using data parallel, the data required for different metric calculations

        are stored in their respective Metric classes,

        and we need to merge these data to uniformly calculate metric.

        Args:
            other: Another Metric instance.

        Returns: None

        Nr	   )r
   r   s     r   ÚmergezMetric.merge*   s	   € ð 	ˆr   N)r   r   )
Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r   r	   r   r   r   r      s–   € € € € € ðð ðð ð ð ð˜4ð ¨ð ð ð ñ „^ðð ðð ñ „^ðð ðð ð ñ „^ðð ð r   r   N)Úabcr   r   Útypingr   r   r	   r   r   ú<module>r      sc   ðà #Ð #Ð #Ð #Ð #Ð #Ð #Ð #Ø Ð Ð Ð Ð Ð ð2ð 2ð 2ð 2ð 2ˆSñ 2ô 2ð 2ð 2ð 2r   