class_docstr: Saves the model by interval in training process.
  
  Args:
     interval (int, optional): Number of epochs between saving the checkpoint, defaults to 1.
          if save_by_iter is True, this arg refers to the number of iters between saving.
     checkpoint_dir (str, optional): File name to save the checkpoint, defaults to None.
     model (torch.nn.Module, Optional): The model to save, defaults to None. When not passing,
          'trainer.engine.model' will be used. We encourage you to pass the model in it to avoid some
          unexpected bugs, especially when using **DDP**.
     save_by_iter (bool, optional): Whether saving the checkpoint by iter, default to False.
     priority (int, optional): Priority in the printing, hooks with small priority will be printed in front
          defaults to 10. If different hooks share same priority, the order of printing would
          depend on the hooks order in the hook list.
code: def __init__(
      self,
      interval: int = 1,
      checkpoint_dir: str = None,
      model: torch.nn.Module = None,
      save_by_iter: bool = False,
      priority: int = 10,
  ):
      super().__init__(priority=priority)
      self.interval = interval
      self.checkpoint_dir = checkpoint_dir
      self.model = model
      self.save_by_iter = save_by_iter
      self.logger = get_dist_logger()
  
      # get lr scheduler from the LRSchedulerHook before train
      self._lr_scheduler = None
  
file_path: ColossalAI/colossalai/legacy/trainer/hooks/_checkpoint_hook.py
imports: import torch
  from colossalai.legacy.registry import HOOKS
  from colossalai.legacy.trainer.hooks import BaseHook
  from colossalai.legacy.utils.checkpointing import save_checkpoint
  from colossalai.logging import get_dist_logger
  from ._lr_scheduler_hook import LRSchedulerHook
label_desc: Use image node_id 1 to create a new SaveCheckpointHook object from inherited base classes: BaseHook with example: obj = SaveCheckpointHook(interval, checkpoint_dir, model, save_by_iter, priority)