
    &`i                         d dl mZmZmZmZ d dlmZ d dlmZ d dl	m
Z
 e
 G d d                      Ze
 G d de                      Zd	S )
    )AnyDictListOptional)
Checkpoint)TrainRunContext)DeveloperAPIc                       e Zd ZdZdS )RayTrainCallbackz"Base Ray Train callback interface.N)__name__
__module____qualname____doc__     m/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/train/v2/api/callback.pyr   r      s        ,,Dr   r   c                   n    e Zd ZdZdedeeeef                  de	e
         fdZdedeeef         fdZdS )	UserCallbackzCallback interface for custom user-defined callbacks to handling events
    during training.

    This callback is called on the Ray Train controller process, not on the
    worker processes.
    run_contextmetrics
checkpointc                     dS )a*  Called after all workers have reported a metric + checkpoint
        via `ray.train.report`.

        Args:
            run_context: The `TrainRunContext` for the current training run.
            metrics: A list of metric dictionaries reported by workers,
                where metrics[i] is the metrics dict reported by worker i.
            checkpoint: A Checkpoint object that has been persisted to
                storage. This is None if no workers reported a checkpoint
                (e.g. `ray.train.report(metrics, checkpoint=None)`).
        Nr   )selfr   r   r   s       r   after_reportzUserCallback.after_report   s	    " 	r   worker_exceptionsc                     dS )a  Called after one or more workers have raised an exception.

        Args:
            run_context: The `TrainRunContext` for the current training run.
            worker_exceptions: A dict from worker world rank to the exception
                raised by that worker.
        Nr   )r   r   r   s      r   after_exceptionzUserCallback.after_exception+   s	     	r   N)r   r   r   r   r   r   r   strr   r   r   r   int	Exceptionr   r   r   r   r   r      s         $ d38n% Z(	   &
*
?CCN?S
 
 
 
 
 
r   r   N)typingr   r   r   r   	ray.trainr   (ray.train.v2._internal.execution.contextr   ray.util.annotationsr	   r   r   r   r   r   <module>r%      s    , , , , , , , , , , , ,             D D D D D D - - - - - - 	 	 	 	 	 	 	 	 % % % % %# % % % % %r   