class_docstr: A runner class to train and evaluate a model given a task and datasets.
  
  The runner uses pytorch distributed data parallel by default. Future release
  will support other distributed frameworks.
class_docstr_tok: ["A","runner","class","to","train","and","evaluate","a","model","given","a","task","and","datasets",".","The","runner","uses","pytorch","distributed","data","parallel","by","default",".","Future","release","will","support","other","distributed","frameworks","."]
docstr: Load the best checkpoint for evaluation.
code: def _reload_best_model(self, model):
      """
      Load the best checkpoint for evaluation.
      """
      checkpoint_path = os.path.join(
          self.output_dir, "checkpoint_best.pth"
      )
  
      logging.info(
          "Loading checkpoint from {}.".format(checkpoint_path)
      )
      checkpoint = torch.load(checkpoint_path, map_location="cpu")
      try:
          model.load_state_dict(checkpoint["model"])
      except RuntimeError as e:
          logging.warning(
              """
                  Key mismatch when loading checkpoint. This is expected if only part of the model is saved.
                  Trying to load the model with strict=False.
                  """
          )
          model.load_state_dict(checkpoint["model"], strict=False)
      return model
  
imports: import datetime
  import json
  import logging
  import os
  import time
  from pathlib import Path
  import torch
  import torch.distributed
  import webdataset
  from lavis.common.dist_utils import download_cached_file, get_rank, get_world_size, is_main_process, main_process
  from lavis.common.registry import registry
  from lavis.common.utils import is_url
  from lavis.datasets.data_utils import concat_datasets, reorg_datasets_by_split
  from lavis.datasets.datasets.dataloader_utils import IterLoader, MultiIterLoader, PrefetchLoader
  from torch.nn.parallel import DistributedDataParallel
  from torch.utils.data import DataLoader, DistributedSampler
  from torch.utils.data.dataset import ChainDataset
label_desc: Use image node_id 33 for calling the RunnerBase obj's underlying member method code with example usage: obj._reload_best_model(model) and returns: model