code: def average_ckpts(ckpt_loc_list: List[str]) -> Dict:
      """Compute averaged parameters from a list of checkpoints.
  
      Args:
          ckpt_loc_list: List of paths to model checkpoints to be averaged.
  
      Returns:
          `state_dict` corresponding to the averaged parameters.
      """
      avg_state_dict = dict()
      key_count = dict()
      key_dtype = dict()
  
      for c in ckpt_loc_list:
          if not os.path.isfile(c):
              pass
          ckpt_state_dict = torch.load(c, map_location="cpu")
  
          for k, v in ckpt_state_dict.items():
              if k not in avg_state_dict:
                  key_dtype[k] = v.dtype
                  avg_state_dict[k] = v.clone().to(dtype=torch.float64)
                  key_count[k] = 1.0
              else:
                  avg_state_dict[k] += v.to(dtype=torch.float64)
                  key_count[k] += 1.0
  
      for k, v in avg_state_dict.items():
          avg_state_dict[k] = v.div(key_count[k]).to(dtype=key_dtype[k])
      return avg_state_dict
  
imports: import argparse
  import glob
  import math
  import os
  from typing import Dict, List, Optional, Tuple, Union
  import torch
  from cvnets import EMA
  from optim import BaseOptim
  from utils import logger
  from utils.common_utils import unwrap_model_fn
  from utils.ddp_utils import is_master
  from utils.download_utils import get_local_path
label_desc: Use image node_id 3 for calling a global function with example usage: average_ckpts(ckpt_loc_list) and returns: avg_state_dict