class_docstr: Light wrapper around Lightning's ModelCheckpoint to force a saved checkpoint on train_end.
  Extends Lightning's on_save_checkpoint func to save the .nemo file. Saves the .nemo file based 
  on the best checkpoint saved (according to the monitor value).
  Also contains func to save the EMA copy of the model.
code: def _del_model_without_trainer(self, filepath: str) -> None:
      filepath = Path(filepath)
  
      # check if filepath is a distributed a checkpoint
      if ckpt_to_dir(filepath).is_dir():
          if is_global_rank_zero():
              try:
                  dist_ckpt = ckpt_to_dir(filepath)
                  shutil.rmtree(dist_ckpt, ignore_errors=True)
                  logging.info(
                      f"Removed distributed checkpoint: {dist_ckpt}"
                  )
              except:
                  logging.info(
                      f"Tried to remove distributed checkpoint: {dist_ckpt} but failed."
                  )
  
      else:
          app_state = AppState()
  
          # legacy model parallel checkpoint
          if (
              app_state.model_parallel_size is not None
              and app_state.model_parallel_size > 1
          ):
              # filepath needs to be updated to include mp_rank
              filepath = inject_model_parallel_rank(filepath)
  
          # each model parallel rank needs to remove its model
          if is_global_rank_zero() or (
              app_state.model_parallel_size is not None
              and app_state.data_parallel_rank == 0
          ):
              try:
                  self._fs.rm(filepath)
                  logging.info(f"Removed checkpoint: {filepath}")
              except:
                  logging.info(
                      f"Tried to remove checkpoint: {filepath} but failed."
                  )
  
imports: import os
  import re
  import shutil
  from copy import deepcopy
  from pathlib import Path
  from typing import Any, Dict, Iterable, List, Optional, Tuple, Union
  import pytorch_lightning
  import torch
  from pytorch_lightning.callbacks import ModelCheckpoint
  from pytorch_lightning.utilities import rank_zero_info
  from nemo.collections.common.callbacks import EMA
  from nemo.utils import logging
  from nemo.utils.app_state import AppState
  from nemo.utils.get_rank import is_global_rank_zero
  from nemo.utils.model_utils import ckpt_to_dir, inject_model_parallel_rank, uninject_model_parallel_rank
label_desc: Use image node_id 5 for calling the NeMoModelCheckpoint obj's underlying member method code with example usage: obj._del_model_without_trainer(filepath) without return types