class_docstr: Hook to checkpoint a model's task.
  
  Saves the checkpoints in checkpoint_folder.
code: def _save_checkpoint(self, task, filename):
      if getattr(task, "test_only", False):
          return
      assert PathManager.exists(
          self.checkpoint_folder
      ), "Checkpoint folder '{}' deleted unexpectedly".format(
          self.checkpoint_folder
      )
  
      # save checkpoint:
      logging.info(
          "Saving checkpoint to '{}'...".format(self.checkpoint_folder)
      )
      checkpoint_file = save_checkpoint(
          self.checkpoint_folder,
          get_checkpoint_dict(task, self.input_args),
      )
  
      # make copy of checkpoint that won't be overwritten:
      PathManager.copy(
          checkpoint_file, f"{self.checkpoint_folder}/{filename}"
      )
  
file_path: ClassyVision/classy_vision/hooks/checkpoint_hook.py
imports: import logging
  from typing import Any, Collection, Dict, Optional
  from classy_vision.generic.distributed_util import is_primary
  from classy_vision.generic.util import get_checkpoint_dict, save_checkpoint
  from classy_vision.hooks import register_hook
  from classy_vision.hooks.classy_hook import ClassyHook
  from fvcore.common.file_io import PathManager
label_desc: Use image node_id 3 for calling the CheckpointHook obj's underlying member method code with example usage: obj._save_checkpoint(task, filename) without return types