
    9i                         S SK Jr  S SKJr  S SKJr  SSKJr  SSKJ	r	  \	R                  " \\R                  S9 " S S	\5      5       rg
)    )Dict)Metrics)default_group   )Metric)METRICS)	group_keymodule_namec                   Z   ^  \ rS rSrSrU 4S jrS\S\4S jrS rSS jr	S	 r
S
 rSrU =r$ )PredictionSavingWrapper   zoThe wrapper to save predictions to file.
Args:
    saving_fn: The saving_fn used to save predictions to files.
c                 2   > [         TU ]  " S0 UD6  Xl        g )N )super__init__	saving_fn)selfr   kwargs	__class__s      l/var/www/html/land-doc-ocr/venv/lib/python3.13/site-packages/modelscope/metrics/prediction_saving_wrapper.pyr    PredictionSavingWrapper.__init__   s    "6""    outputsinputsc                 &    U R                  X!5        g Nr   )r   r   r   s      r   addPredictionSavingWrapper.add   s    v'r   c                     0 $ r   r   r   s    r   evaluate PredictionSavingWrapper.evaluate   s    	r   c                     g r   r   )r   others     r   mergePredictionSavingWrapper.merge       r   c                     g r   r   r!   s    r   __getstate__$PredictionSavingWrapper.__getstate__    r(   r   c                     g r   r   )r   states     r   __setstate__$PredictionSavingWrapper.__setstate__#   r(   r   r   )r%   r   )__name__
__module____qualname____firstlineno____doc__r   r   r   r"   r&   r*   r.   __static_attributes____classcell__)r   s   @r   r   r      s9    
#(4 ( ( r   r   N)typingr   modelscope.metainfor   modelscope.utils.registryr   baser   builderr   register_moduleprediction_saving_wrapperr   r   r   r   <module>r>      sI     ' 3   	)J)JLf Lr   