
    &`is              	       n   d dl mZmZ d dlmZ d dlmZmZ d dl	m
Z
mZ d dlmZmZ d dlmZ  ee           G d de                      Z ed	
           e            dddedee         ddfd                        Z ed	
           e            dee         fd                        ZdefdZdS )    )DictOptional)
Checkpoint)_warn_session_misuseget_session)V2_MIGRATION_GUIDE_MESSAGE_v2_migration_warnings_enabled)	_copy_doc_log_deprecation_warning)	PublicAPIc                       e Zd ZdS )r   N)__name__
__module____qualname__     y/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/tune/trainable/trainable_fn_utils.pyr   r      s         	Dr   r   stable)	stabilityN
checkpointmetricsr   returnc                    |r:t          |t                    s%t                      rt          dt                      t                                          | |           dS )a`  Report metrics and optionally save and register a checkpoint to Ray Tune.

    If a checkpoint is provided, it will be
    :ref:`persisted to storage <persistent-storage-guide>`.

    .. note::

        Each invocation of this method will automatically increment the underlying
        ``training_iteration`` number. The physical meaning of this "iteration" is
        defined by user depending on how often they call ``report``.
        It does not necessarily map to one epoch.

    Args:
        metrics: The metrics you want to report.
        checkpoint: The optional checkpoint you want to report.
    zThe `Checkpoint` class should be imported from `ray.tune` when passing it to `ray.tune.report` in a Tune function. Please update your imports. r   N)
isinstancer   r	   r   r   r   report)r   r   s     r   r   r      sv    &  *Z<< )++ 	$0 .0 0   MMZ88888r   c                  (    t                      j        S )zCAccess the latest reported checkpoint to resume from if one exists.)r   loaded_checkpointr   r   r   get_checkpointr   3   s    
 ==**r   c                  H    t                      ot                      j        d u S )N)r   
world_rankr   r   r   _in_tune_sessionr"   ;   s    ===[]]5==r   )typingr   r   ray.train._checkpointr   TrainCheckpointray.train._internal.sessionr   r   ray.train.constantsr   r	   ray.train.utilsr
   r   ray.util.annotationsr   r   r   boolr"   r   r   r   <module>r+      s   ! ! ! ! ! ! ! ! ? ? ? ? ? ? I I I I I I I I        @ ? ? ? ? ? ? ? * * * * * * ?	 	 	 	 	 	 	 	 X@D 9 9 9D 9*)= 9 9 9 9  9: X+, + + +  +>$ > > > > > >r   