ó
    È9i®  ã                   ó6   • S SK JrJr  S SKJr   " S S\5      rg)é    )ÚABCÚabstractmethod)ÚDictc                   ó^   • \ rS rSrSrS r\S\S\4S j5       r\S 5       r	\SS j5       r
S	rg
)ÚMetricé   zÍ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                 ó   • g )N© )ÚselfÚargsÚkwargss      ÚW/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/modelscope/metrics/base.pyÚ__init__ÚMetric.__init__   s   € Øó    ÚoutputsÚinputsc                 ó   • g)a  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   ÚaddÚ
Metric.add   s   € ð 	r   c                 ó   • g)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   ÚevaluateÚMetric.evaluate   s   € ð 	r   c                 ó   • g)zù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   Úothers     r   ÚmergeÚMetric.merge*   s   € ð 	r   r
   N)r   r   )Ú__name__Ú
__module__Ú__qualname__Ú__firstlineno__Ú__doc__r   r   r   r   r   r   Ú__static_attributes__r
   r   r   r   r      sV   † ñòð ð˜4ð ¨ó ó ðð ñó ðð óó ór   r   N)Úabcr   r   Útypingr   r   r
   r   r   Ú<module>r&      s   ðç #Ý ô2ˆSõ 2r   