class_docstr: Base class for Tune's PyTorch Lightning callbacks.
  
  Args:
      When to trigger checkpoint creations. Must be one of
      the PyTorch Lightning event hooks (less the ``on_``), e.g.
      "train_batch_start", or "train_end". Defaults to "validation_end"
code: def __init__(self, on: Union[str, List[str]] = "validation_end"):
      if not isinstance(on, list):
          on = [on]
  
      for hook in on:
          if f"on_{hook}" not in _allowed_hooks:
              raise ValueError(
                  f"Invalid hook selected: {hook}. Must be one of "
                  f"{_allowed_hooks}"
              )
  
      # Add back the "on_" prefix for internal consistency.
      on = [f"on_{hook}" for hook in on]
  
      self._on = on
  
imports: import inspect
  import logging
  import os
  import tempfile
  import warnings
  from contextlib import contextmanager
  from typing import Dict, List, Optional, Type, Union
  from pytorch_lightning import Callback, Trainer, LightningModule
  from ray import train
  from ray.util import log_once
  from ray.util.annotations import PublicAPI, Deprecated
  from ray.train import Checkpoint
label_desc: Use image node_id 1 to create a new TuneCallback object from inherited base classes: Callback with example: obj = TuneCallback(on)