docstr: Save model/training states as a checkpoint file through state-dump and file-write.
  
  Args:
      checkpoint: The checkpoint state dictionary
      filepath: write-target file's path
      storage_options: not used for ``DeepSpeedStrategy`` as ``CheckpointIO`` is not used
  
  Raises:
      TypeError:
          If ``storage_options`` arg is passed in
docstr_tok: ["Save","model\/training","states","as","a","checkpoint","file","through","state-dump","and","file-write",".","Args",":","checkpoint",":","The","checkpoint","state","dictionary","filepath",":","write-target","file","'s","path","storage_options",":","not","used","for","``","DeepSpeedStrategy","``","as","``","CheckpointIO","``","is","not","used","Raises",":","TypeError",":","If","``","storage_options","``","arg","is","passed","in"]
code: def save_checkpoint(
      self,
      checkpoint: Dict,
      filepath: _PATH,
      storage_options: Optional[Any] = None,
  ) -> None:
      """Save model/training states as a checkpoint file through state-dump and file-write.
  
      Args:
          checkpoint: The checkpoint state dictionary
          filepath: write-target file's path
          storage_options: not used for ``DeepSpeedStrategy`` as ``CheckpointIO`` is not used
  
      Raises:
          TypeError:
              If ``storage_options`` arg is passed in
  
      """
      # broadcast the filepath from rank 0 to ensure all the states are saved in a common filepath
      filepath = self.broadcast(filepath)
  
      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__}` as `CheckpointIO` is not used."
          )
  
      if (
          self.zero_stage_3
          and self._multi_device
          and self.is_global_zero
      ):
          warning_cache.warn(
              "When saving the DeepSpeed Stage 3 checkpoint, "
              "each worker will save a shard of the checkpoint within a directory. "
              "If a single file is required after training, "
              "see https://lightning.ai/docs/pytorch/stable/advanced/model_parallel.html#"
              "deepspeed-zero-stage-3-single-file for instructions."
          )
      # Use deepspeed's internal checkpointing function to handle partitioned weights across processes
      # dump states as a checkpoint dictionary object
      _exclude_keys = ["state_dict", "optimizer_states"]
      checkpoint = {
          k: v for k, v in checkpoint.items() if k not in _exclude_keys
      }
      self.deepspeed_engine.save_checkpoint(
          filepath, client_state=checkpoint, tag="checkpoint"
      )
  
imports: import argparse
  import json
  import logging
  import os
  import platform
  from collections import OrderedDict
  from contextlib import contextmanager
  from pathlib import Path
  from typing import TYPE_CHECKING, Any, Dict, Generator, List, Mapping, Optional, Tuple, Union
  import torch
  from torch.nn import Module
  from torch.optim import Optimizer
  from typing_extensions import override
  import lightning.pytorch
  from lightning.fabric.plugins import ClusterEnvironment
  from lightning.fabric.strategies import _StrategyRegistry
  from lightning.fabric.strategies.deepspeed import _DEEPSPEED_AVAILABLE, _format_precision_config, _validate_checkpoint_directory, _validate_device_index_selection
  from lightning.fabric.utilities.optimizer import _optimizers_to_device
  from lightning.fabric.utilities.seed import reset_seed
  from lightning.fabric.utilities.types import _PATH, LRScheduler, ReduceLROnPlateau
  from lightning.pytorch.accelerators.cuda import CUDAAccelerator
  from lightning.pytorch.core.optimizer import _init_optimizers_and_lr_schedulers
  from lightning.pytorch.plugins.precision import Precision
  from lightning.pytorch.strategies.ddp import DDPStrategy
  from lightning.pytorch.trainer.states import TrainerFn
  from lightning.pytorch.utilities import GradClipAlgorithmType
  from lightning.pytorch.utilities.exceptions import MisconfigurationException
  from lightning.pytorch.utilities.model_helpers import is_overridden
  from lightning.pytorch.utilities.rank_zero import WarningCache, rank_zero_info, rank_zero_warn
  from lightning.pytorch.utilities.types import LRSchedulerConfig
label_desc: Use image node_id 23 for calling the DeepSpeedStrategy obj's underlying member method code with example usage: obj.save_checkpoint(checkpoint, filepath, storage_options) without return types