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: Resume from a checkpoint.
code: def _load_checkpoint(self, url_or_filename):
      """
      Resume from a checkpoint.
      """
      if is_url(url_or_filename):
          cached_file = download_cached_file(
              url_or_filename, check_hash=False, progress=True
          )
          checkpoint = torch.load(cached_file, map_location=self.device)
      elif os.path.isfile(url_or_filename):
          checkpoint = torch.load(
              url_or_filename, map_location=self.device
          )
      else:
          raise RuntimeError("checkpoint url or path is invalid")
  
      state_dict = checkpoint["model"]
      self.unwrap_dist_model(self.model).load_state_dict(state_dict)
  
      self.optimizer.load_state_dict(checkpoint["optimizer"])
      if self.scaler and "scaler" in checkpoint:
          self.scaler.load_state_dict(checkpoint["scaler"])
  
      self.start_epoch = checkpoint["epoch"] + 1
      logging.info("Resume checkpoint from {}".format(url_or_filename))
  
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 34 for calling the RunnerBase obj's underlying member method code with example usage: obj._load_checkpoint(url_or_filename) without return types