class_docstr: Class to help manage, save, clean up, and average checkpoints.
code: def _initialize(self):
      # Loads and intializes the previous checkpoint params average.
      for f in self._checkpoint_files:
          # Loads everything to CPU memory to save space on GPU memory.
          state: Dict[str, Any] = load_to_cpu(f)
          model_params: OrderedDict = state["model"]
          for k, v in model_params.items():
              v = convert_tensor(v, clone=False)
              if k not in self._averaged_params:
                  self._averaged_params[k] = (
                      v
                      if is_integer_tensor(v)
                      else v / len(self._checkpoint_files)
                  )
              else:
                  sanity_check_tensor(
                      tensor_name=k,
                      old_tensor=self._averaged_params[k],
                      new_tensor=v,
                  )
                  if not is_integer_tensor(v):
                      self._averaged_params[k].add_(
                          v / len(self._checkpoint_files)
                      )
  
      self._initialized = True
  
imports: import os
  from collections import deque, OrderedDict
  from typing import Any, Deque, Dict, List, Optional, Tuple
  import torch
  from fairseq import checkpoint_utils, utils
  from pytorch_translate import constants
  from pytorch_translate.file_io import PathManager
label_desc: Use image node_id 3 for calling the CheckpointManager obj's underlying member method code with example usage: obj._initialize() without return types