code: def average(param_paths: Iterable[str]) -> Dict[str, torch.Tensor]:
      """
      Averages parameters from a list of .params file paths.
  
      :param param_paths: List of paths to parameter files.
      :return: Averaged parameter dictionary.
      """
      all_params = []  # type: List[Dict[str, torch.Tensor]]
      for path in param_paths:
          logger.info("Loading parameters from '%s'", path)
          params = torch.load(path, map_location=torch.device("cpu"))
          all_params.append(params)
  
      logger.info("%d models loaded", len(all_params))
      utils.check_condition(
          all(all_params[0].keys() == p.keys() for p in all_params),
          "param names do not match across models",
      )
  
      avg_params = {}
      # average arg_params
      for k in all_params[0]:
          tensors = [p[k] for p in all_params]
          avg_params[k] = utils.average_tensors(tensors)
      return avg_params
  
file_path: sockeye/sockeye/average.py
imports: import argparse
  import itertools
  import logging
  import os
  from typing import Dict, Iterable, List
  import torch
  from .None import arguments
  from .None import constants
  from .None import utils
  from .log import setup_main_logger, log_sockeye_version
label_desc: Use image node_id 1 for calling a global function with example usage: average(param_paths) and returns: avg_params