class_docstr: Iteration-based Runner.
  
  This runner train models iteration by iteration.
class_docstr_tok: ["Iteration-based","Runner",".","This","runner","train","models","iteration","by","iteration","."]
docstr: Resume model from checkpoint.
  
  Args:
      checkpoint (str): Checkpoint to resume from.
      resume_optimizer (bool, optional): Whether resume the optimizer(s)
          if the checkpoint file includes optimizer(s). Default to True.
      map_location (str, optional): Same as :func:`torch.load`.
          Default to 'default'.
docstr_tok: ["Resume","model","from","checkpoint",".","Args",":","checkpoint","(","str",")",":","Checkpoint","to","resume","from",".","resume_optimizer","(","bool",",","optional",")",":","Whether","resume","the","optimizer","(","s",")","if","the","checkpoint","file","includes","optimizer","(","s",")",".","Default","to","True",".","map_location","(","str",",","optional",")",":","Same","as",":","func",":","`","torch.load","`",".","Default","to","'default","'","."]
code: def resume(
      self, checkpoint, resume_optimizer=True, map_location="default"
  ):
      """Resume model from checkpoint.
  
      Args:
          checkpoint (str): Checkpoint to resume from.
          resume_optimizer (bool, optional): Whether resume the optimizer(s)
              if the checkpoint file includes optimizer(s). Default to True.
          map_location (str, optional): Same as :func:`torch.load`.
              Default to 'default'.
      """
      if map_location == "default":
          device_id = torch.cuda.current_device()
          checkpoint = self.load_checkpoint(
              checkpoint,
              map_location=lambda storage, loc: storage.cuda(device_id),
          )
      else:
          checkpoint = self.load_checkpoint(
              checkpoint, map_location=map_location
          )
  
      self._epoch = checkpoint["meta"]["epoch"]
      self._iter = checkpoint["meta"]["iter"]
      self._inner_iter = checkpoint["meta"]["iter"]
      if "optimizer" in checkpoint and resume_optimizer:
          if isinstance(self.optimizer, Optimizer):
              self.optimizer.load_state_dict(checkpoint["optimizer"])
          elif isinstance(self.optimizer, dict):
              for k in self.optimizer.keys():
                  self.optimizer[k].load_state_dict(
                      checkpoint["optimizer"][k]
                  )
          else:
              raise TypeError(
                  "Optimizer should be dict or torch.optim.Optimizer "
                  f"but got {type(self.optimizer)}"
              )
  
      self.logger.info(
          f"resumed from epoch: {self.epoch}, iter {self.iter}"
      )
  
imports: import os.path
  import platform
  import shutil
  import time
  import warnings
  import torch
  from torch.optim import Optimizer
  import annotator.uniformer.mmcv
  from .base_runner import BaseRunner
  from .builder import RUNNERS
  from .checkpoint import save_checkpoint
  from .hooks import IterTimerHook
  from .utils import get_host_info
label_desc: Use image node_id 4 for calling the IterBasedRunner obj's underlying member method code with example usage: obj.resume(checkpoint, resume_optimizer, map_location) without return types