class_docstr: Run training based on the number of iterations. This is common when
  the training dataset size is large. Underhood logic is similar to
  epoch-based training by considering every #iters_per_inner_epoch as an
  inner epoch.
  
  In iter-based runner, after every #iters_per_inner_epoch steps, we
  
      1) do a validation epoch;
      2) schedule the learning rate;
      3) save the checkpoint.
  
  We refer every #iters_per_inner_epoch steps as an inner epoch.
class_docstr_tok: ["Run","training","based","on","the","number","of","iterations",".","This","is","common","when","the","training","dataset","size","is","large",".","Underhood","logic","is","similar","to","epoch-based","training","by","considering","every","#","iters_per_inner_epoch","as","an","inner","epoch",".","In","iter-based","runner",",","after","every","#","iters_per_inner_epoch","steps",",","we","1",")","do","a","validation","epoch",";","2",")","schedule","the","learning","rate",";","3",")","save","the","checkpoint",".","We","refer","every","#","iters_per_inner_epoch","steps","as","an","inner","epoch","."]
docstr: Resume from a checkpoint.
docstr_tok: ["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_iters = checkpoint["iters"] + 1
      logging.info("Resume checkpoint from {}".format(url_or_filename))
  
imports: import datetime
  import logging
  import os
  import time
  import torch
  import torch.distributed
  import webdataset
  from lavis.common.dist_utils import download_cached_file, 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.runners.runner_base import RunnerBase
  from torch.utils.data.dataset import ChainDataset
label_desc: Use image node_id 8 for calling the RunnerIter obj's underlying member method code with example usage: obj._load_checkpoint(url_or_filename) without return types