docstr: Save optimizer to checkpoint but only on master process.
  
  Args:
      optimizer (OptimizerWrapper): Optimizer to save state_dict
      checkpoint (str): Path to save checkpoint
      gather_dtensor (bool): Whether to gather_dtensor, not used
code: def save_unsharded_optimizer(
      self,
      optimizer: OptimizerWrapper,
      checkpoint: str,
      gather_dtensor: bool = False,
  ):
      """Save optimizer to checkpoint but only on master process.
  
      Args:
          optimizer (OptimizerWrapper): Optimizer to save state_dict
          checkpoint (str): Path to save checkpoint
          gather_dtensor (bool): Whether to gather_dtensor, not used
      """
      assert isinstance(
          optimizer, LowLevelZeroOptimizer
      ), "Please boost the optimizer before saving!"
      # the `state_dict` in LowLevelZeroOptimizer has communication
      # if only the master rank collect state_dict and save,
      # the communication on each rank would not match
      state_dict = optimizer.state_dict()
      if self.coordinator.is_master():
          save_state_dict(state_dict, checkpoint, use_safetensors=False)
  
imports: import logging
  import os
  from functools import partial
  from pathlib import Path
  from types import MethodType
  from typing import Callable, Iterator, List, Optional, Tuple
  import torch
  import torch.nn
  from torch.optim import Optimizer
  from torch.optim.lr_scheduler import _LRScheduler
  from torch.utils._pytree import tree_map
  from torch.utils.data import DataLoader
  from colossalai.checkpoint_io import CheckpointIndexFile, CheckpointIO
  from colossalai.checkpoint_io.utils import get_optimizer_base_filenames, get_shard_filename, load_param_groups_into_optimizer, load_shard_state_dict, load_states_into_optimizer, save_param_groups, save_state_dict, sharded_optimizer_loading_epilogue
  from colossalai.interface import AMPModelMixin, ModelWrapper, OptimizerWrapper
  from colossalai.utils import get_current_device
  from colossalai.zero import LowLevelZeroOptimizer
  from .dp_plugin_base import DPPluginBase
  from .torch_ddp_plugin import TorchDDPCheckpointIO
label_desc: Use image node_id 1 for calling the LowLevelZeroCheckpointIO obj's underlying member method code with example usage: obj.save_unsharded_optimizer(optimizer, checkpoint, gather_dtensor) without return types