class_docstr: Keras report and checkpoint callback
  
  Saves checkpoints after each validation step. Also reports metrics to Tune,
  which is needed for checkpoint registration.
  
  Use this callback to register saved checkpoints with Ray Tune. This means
  that checkpoints will be manages by the `CheckpointManager` and can be
  used for advanced scheduling and search  algorithms, like
  Population Based Training.
  
  The ``tf.keras.callbacks.ModelCheckpoint`` callback also saves checkpoints,
  but doesn't register them with Ray Tune.
  
  Args:
      metrics: Metrics to report to Tune. If this is a list,
          each item describes the metric key reported to Keras,
          and it will reported under the same name to Tune. If this is a
          dict, each key will be the name reported to Tune and the respective
          value will be the metric key reported to Keras. If this is None,
          all Keras logs will be reported.
      filename: Filename of the checkpoint within the checkpoint
          directory. Defaults to "checkpoint".
      frequency: Checkpoint frequency. If this is an integer `n`,
          checkpoints are saved every `n` times each hook was called. If
          this is a list, it specifies the checkpoint frequencies for each
          hook individually.
      on: When to trigger checkpoint creations. Must be one of
          the Keras event hooks (less the ``on_``), e.g.
          "train_start", or "predict_end". Defaults to "epoch_end".
  
  
  Example:
  
  .. code-block:: python
  
      from ray.tune.integration.keras import TuneReportCheckpointCallback
  
      # Save checkpoint and report accuracy to Tune after each epoch:
      model.fit(
          x_train,
          y_train,
          batch_size=batch_size,
          epochs=epochs,
          verbose=0,
          validation_data=(x_test, y_test),
          callbacks=[TuneReportCheckpointCallback(
              metrics={"mean_accuracy": "accuracy"},
              filename="model",
              on="epoch_end")])
class_docstr_tok: ["Keras","report","and","checkpoint","callback","Saves","checkpoints","after","each","validation","step",".","Also","reports","metrics","to","Tune",",","which","is","needed","for","checkpoint","registration",".","Use","this","callback","to","register","saved","checkpoints","with","Ray","Tune",".","This","means","that","checkpoints","will","be","manages","by","the","`","CheckpointManager","`","and","can","be","used","for","advanced","scheduling","and","search","algorithms",",","like","Population","Based","Training",".","The","``","tf.keras.callbacks.ModelCheckpoint","``","callback","also","saves","checkpoints",",","but","does","n't","register","them","with","Ray","Tune",".","Args",":","metrics",":","Metrics","to","report","to","Tune",".","If","this","is","a","list",",","each","item","describes","the","metric","key","reported","to","Keras",",","and","it","will","reported","under","the","same","name","to","Tune",".","If","this","is","a","dict",",","each","key","will","be","the","name","reported","to","Tune","and","the","respective","value","will","be","the","metric","key","reported","to","Keras",".","If","this","is","None",",","all","Keras","logs","will","be","reported",".","filename",":","Filename","of","the","checkpoint","within","the","checkpoint","directory",".","Defaults","to","``","checkpoint","''",".","frequency",":","Checkpoint","frequency",".","If","this","is","an","integer","`","n","`",",","checkpoints","are","saved","every","`","n","`","times","each","hook","was","called",".","If","this","is","a","list",",","it","specifies","the","checkpoint","frequencies","for","each","hook","individually",".","on",":","When","to","trigger","checkpoint","creations",".","Must","be","one","of","the","Keras","event","hooks","(","less","the","``","on_","``",")",",","e.g",".","``","train_start","''",",","or","``","predict_end","''",".","Defaults","to","``","epoch_end","''",".","Example",":","..","code-block",":",":","python","from","ray.tune.integration.keras","import","TuneReportCheckpointCallback","#","Save","checkpoint","and","report","accuracy","to","Tune","after","each","epoch",":","model.fit","(","x_train",",","y_train",",","batch_size=batch_size",",","epochs=epochs",",","verbose=0",",","validation_data=","(","x_test",",","y_test",")",",","callbacks=","[","TuneReportCheckpointCallback","(","metrics=","{","``","mean_accuracy","''",":","``","accuracy","''","}",",","filename=","''","model","''",",","on=","''","epoch_end","''",")","]",")"]
code: def set_model(self, model):
      # Pass through for the checkpoint callback to set model
      self._checkpoint.set_model(model)
      self._report.set_model(model)
  
file_path: ray/python/ray/tune/integration/keras.py
imports: import os
  from collections import Counter
  from typing import Dict, List, Optional, Union
  from ray import tune
  from ray.util.annotations import Deprecated
  from ray.air.integrations.keras import _Callback
label_desc: Use image node_id 3 for calling the TuneReportCheckpointCallback obj's underlying member method code with example usage: obj.set_model(model) without return types