class_docstr: Class that customizes how checkpoints are saved. Saves either the entire model or only parameters that have been explicitly updated during training. The latter reduces memory footprint substantially when training very large models with parameter-efficient finetuning methods.
  Class is based on plugins.TorchCheckpointIO.
docstr: Save model/training states as a checkpoint file through state-dump and file-write.
  
  Parameters
  ----------
  checkpoint
      dict containing model and trainer state
  path
      write-target path
  storage_options
      Optional parameters when saving the model/training states. Not currently considered.
docstr_tok: ["Save","model\/training","states","as","a","checkpoint","file","through","state-dump","and","file-write",".","Parameters","--","--","--","--","--","checkpoint","dict","containing","model","and","trainer","state","path","write-target","path","storage_options","Optional","parameters","when","saving","the","model\/training","states",".","Not","currently","considered","."]
code: def save_checkpoint(
      self,
      checkpoint: Dict[str, Any],
      path,
      storage_options: Optional[Any] = None,
  ) -> None:
      """
      Save model/training states as a checkpoint file through state-dump and file-write.
  
      Parameters
      ----------
      checkpoint
          dict containing model and trainer state
      path
          write-target path
      storage_options
          Optional parameters when saving the model/training states. Not currently considered.
      """
      if storage_options is not None:
          raise TypeError(
              "`Trainer.save_checkpoint(..., storage_options=...)` with `storage_options` arg"
              f" is not supported for `{self.__class__.__name__}`."
          )
  
      if "state_dict" in checkpoint:
          if self.trainable_param_names:
              updated_params = {}
              for name, param in checkpoint["state_dict"].items():
                  adjusted_name = name.replace("model.", "", 1)
                  if (
                      adjusted_name in self.model_name_to_id
                      and self.model_name_to_id[adjusted_name] == 0
                  ):
                      updated_params[name] = param
                  if any(
                      [
                          re.match(trainable_param_name, name)
                          for trainable_param_name in self.trainable_param_names
                      ]
                  ):
                      updated_params[name] = param
          else:
              updated_params = checkpoint["state_dict"]
  
          checkpoint["state_dict"] = updated_params
  
      fs = get_filesystem(path)
      fs.makedirs(os.path.dirname(path), exist_ok=True)
      try:
          # write the checkpoint dictionary on the file
          _atomic_save(checkpoint, path)
      except AttributeError as err:
          # todo (sean): is this try catch necessary still?
          # https://github.com/Lightning-AI/lightning/pull/431
          key = pl.LightningModule.CHECKPOINT_HYPER_PARAMS_KEY
          checkpoint.pop(key, None)
          rank_zero_warn(
              f"Warning, `{key}` dropped from checkpoint. An attribute is not picklable: {err}"
          )
          _atomic_save(checkpoint, path)
  
imports: import logging
  import os
  import re
  import shutil
  from typing import Any, Dict, List, Optional, Tuple, Union
  import lightning.pytorch
  import torch
  from lightning.pytorch.strategies import DeepSpeedStrategy
  from lightning.pytorch.utilities.rank_zero import rank_zero_warn
  from .cloud_io import _atomic_save
  from .cloud_io import _load
  from .cloud_io import get_filesystem
label_desc: Use image node_id 2 for calling the AutoMMModelCheckpointIO obj's underlying member method code with example usage: obj.save_checkpoint(checkpoint, path, storage_options) without return types