code: def find_checkpoints(
      model_path: str,
      size=4,
      strategy="best",
      metric: str = C.PERPLEXITY,
  ) -> List[str]:
      """
      Finds N best points from .metrics file according to strategy.
  
      :param model_path: Path to model.
      :param size: Number of checkpoints to combine.
      :param strategy: Combination strategy.
      :param metric: Metric according to which checkpoints are selected.  Corresponds to columns in model/metrics file.
      :return: List of paths corresponding to chosen checkpoints.
      """
      maximize = C.METRIC_MAXIMIZE[metric]
      points = utils.get_validation_metric_points(
          model_path=model_path, metric=metric
      )
      # keep only points for which .param files exist
      param_path = os.path.join(model_path, C.PARAMS_NAME)
      points = [
          (value, checkpoint)
          for value, checkpoint in points
          if os.path.exists(param_path % checkpoint)
      ]
  
      if strategy == C.AVERAGE_BEST:
          # N best scoring points
          top_n = strategy_best(points, size, maximize)
  
      elif strategy == C.AVERAGE_LAST:
          # N sequential points ending with overall best
          top_n = strategy_last(points, size, maximize)
  
      elif strategy == C.AVERAGE_LIFESPAN:
          # Track lifespan of every "new best" point
          # Points dominated by a previous better point have lifespan 0
          top_n = strategy_lifespan(points, size, maximize)
      else:
          raise RuntimeError(
              "Unknown strategy, options: best last lifespan"
          )
  
      # Assemble paths for params files corresponding to chosen checkpoints
      # Last element in point is always the checkpoint id
      params_paths = [
          os.path.join(model_path, C.PARAMS_NAME % point[-1])
          for point in top_n
      ]
  
      # Report
      logger.info("Found: " + ", ".join(str(point) for point in top_n))
  
      return params_paths
  
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 2 for calling a global function with example usage: find_checkpoints(model_path, size, strategy, metric) and returns: params_paths