o
    `۷i	                     @   s   d dl mZ d dlmZmZmZmZmZ d dlm	Z	 er"d dl
mZ e	ddG dd deZee	ddG d	d
 d
Ze	ddG dd dZdS )    )	dataclass)TYPE_CHECKINGAnyDictOptionalProtocol)	PublicAPI)
Checkpointalpha)	stabilityc                   @   s&   e Zd ZdZdddedefddZdS )	ValidationFnz4Protocol for a function that validates a checkpoint.
checkpointr	   kwargsreturnc                 K   s   d S N )selfr   r   r   r   X/home/ubuntu/vllm_env/lib/python3.10/site-packages/ray/train/v2/api/validation_config.py__call__   s   zValidationFn.__call__N)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   
   s    r   c                   @   s2   e Zd ZU dZdZeeeef  e	d< dd Z
dS )ValidationTaskConfiga  Configuration for a specific validation task, passed to report().

    Args:
        fn_kwargs: json-serializable keyword arguments to pass to the validation function.
            Note that we always pass `checkpoint` as the first argument to the
            validation function.
    N	fn_kwargsc                 C   s   | j d u r
i | _ d S d S r   )r   )r   r   r   r   __post_init__   s   

z"ValidationTaskConfig.__post_init__)r   r   r   r   r   r   r   strr   __annotations__r   r   r   r   r   r      s   
 r   c                
   @   s<   e Zd ZdZ		ddedee deeee	f  fddZ
dS )	ValidationConfigae  Configuration for validation, passed to the trainer.

    Args:
        fn: The validation function to run on checkpoints.
            This function should accept a checkpoint as the first argument
            and return a dictionary of metrics.
        task_config: Default configuration for validation tasks.
            The fn_kwargs in this config can be overridden by
            ValidationTaskConfig passed to report().
        ray_remote_kwargs: Keyword arguments to pass to `ray.remote()` for the validation task.
            This can be used to specify resource requirements, number of retries, etc.
    Nfntask_configray_remote_kwargsc                 C   s:   || _ |d u rt | _n|| _|d u ri | _d S || _d S r   )r   r   r    r!   )r   r   r    r!   r   r   r   __init__3   s   


zValidationConfig.__init__)NN)r   r   r   r   r   r   r   r   r   r   r"   r   r   r   r   r   $   s    r   N)dataclassesr   typingr   r   r   r   r   ray.util.annotationsr   	ray.trainr	   r   r   r   r   r   r   r   <module>   s    