
    &`i	                         d dl mZ d dlZd dlmZ d dlmZ d dlm	Z	 dZ
 G d d          Z G d	 d
          Z e	d           G d de                      ZdS )    )DictN)TensorflowCheckpoint)RayReportCallback)	PublicAPIzxThe `ray.tune.integration.keras` module is deprecated in favor of `ray.train.tensorflow.keras.ReportCheckpointCallback`.c                       e Zd ZdZd ZdS )TuneReportCallbackYDeprecated.
    Use :class:`ray.train.tensorflow.keras.ReportCheckpointCallback` instead.c                 *    t          t                    NDeprecationWarning_DEPRECATION_MESSAGEclsargskwargss      n/home/jaya/work/projects/VOICE-AGENT/VIET/agent-env/lib/python3.11/site-packages/ray/tune/integration/keras.py__new__zTuneReportCallback.__new__        !5666    N__name__
__module____qualname____doc__r    r   r   r   r      /        Q Q7 7 7 7 7r   r   c                       e Zd ZdZd ZdS )_TuneCheckpointCallbackr	   c                 *    t          t                    r   r   r   s      r   r   z_TuneCheckpointCallback.__new__   r   r   Nr   r   r   r   r   r      r   r   r   alpha)	stabilityc                   .    e Zd ZdZdedefdZdefdZdS )TuneReportCheckpointCallbackaW  Keras callback for Ray Tune reporting and checkpointing.

    .. note::
        Metrics are always reported with checkpoints, even if the event isn't specified
        in ``report_metrics_on``.

    Example:
        .. code-block:: python

            ############# Using it in Ray Tune ###############
            from ray.tune.integrations.keras import TuneReportCheckpointCallback

            def train_fn():
                model = build_model()
                model.fit(dataset_shard, callbacks=[TuneReportCheckpointCallback()])

            tuner = tune.Tuner(train_fn)
            results = tuner.fit()

    Args:
        metrics: Metrics to report. If this is a list, each item describes
            the metric key reported to Keras, and it's reported under the
            same name. If this is a dict, each key is the name reported
            and the respective value is the metric key reported to Keras.
            If this is None, all Keras logs are reported.
        report_metrics_on: When to report metrics. Must be one of
            the Keras event hooks (less the ``on_``), e.g.
            "train_start" or "predict_end". Defaults to "epoch_end".
        checkpoint_on: When to save checkpoints. Must be one of the Keras event hooks
            (less the ``on_``), e.g. "train_start" or "predict_end". Defaults to
            "epoch_end".

    metrics
checkpointc                 H    t           j                            ||           d S )N)r&   raytunereport)selfr%   r&   s      r   _save_and_report_checkpointz8TuneReportCheckpointCallback._save_and_report_checkpointB   s"     	J77777r   c                 D    t           j                            |           d S r   r(   )r,   r%   s     r   _report_metricsz,TuneReportCheckpointCallback._report_metricsG   s         r   N)r   r   r   r   r   r   r-   r/   r   r   r   r$   r$      s^           D88)=8 8 8 8
!t ! ! ! ! ! !r   r$   )typingr   ray.tuner)   ray.train.tensorflowr   ray.train.tensorflow.kerasr   ray.util.annotationsr   r   r   r   r$   r   r   r   <module>r5      s           5 5 5 5 5 5 8 8 8 8 8 8 * * * * * *= 7 7 7 7 7 7 7 77 7 7 7 7 7 7 7 W)! )! )! )! )!#4 )! )! )! )! )!r   