class_docstr: The base class of Runner, a training helper for PyTorch.
  
  All subclasses should implement the following APIs:
  
  - ``run()``
  - ``train()``
  - ``val()``
  - ``save_checkpoint()``
  
  Args:
      model (:obj:`torch.nn.Module`): The model to be run.
      batch_processor (callable): A callable method that process a data
          batch. The interface of this method should be
          `batch_processor(model, data, train_mode) -> dict`
      optimizer (dict or :obj:`torch.optim.Optimizer`): It can be either an
          optimizer (in most cases) or a dict of optimizers (in models that
          requires more than one optimizer, e.g., GAN).
      work_dir (str, optional): The working directory to save checkpoints
          and logs. Defaults to None.
      logger (:obj:`logging.Logger`): Logger used during training.
           Defaults to None. (The default value is just for backward
           compatibility)
      meta (dict | None): A dict records some import information such as
          environment info and seed, which will be logged in logger hook.
          Defaults to None.
      max_epochs (int, optional): Total training epochs.
      max_iters (int, optional): Total training iterations.
class_docstr_tok: ["The","base","class","of","Runner",",","a","training","helper","for","PyTorch",".","All","subclasses","should","implement","the","following","APIs",":","-","``","run","(",")","``","-","``","train","(",")","``","-","``","val","(",")","``","-","``","save_checkpoint","(",")","``","Args",":","model","(",":","obj",":","`","torch.nn.Module","`",")",":","The","model","to","be","run",".","batch_processor","(","callable",")",":","A","callable","method","that","process","a","data","batch",".","The","interface","of","this","method","should","be","`","batch_processor","(","model",",","data",",","train_mode",")","-",">","dict","`","optimizer","(","dict","or",":","obj",":","`","torch.optim.Optimizer","`",")",":","It","can","be","either","an","optimizer","(","in","most","cases",")","or","a","dict","of","optimizers","(","in","models","that","requires","more","than","one","optimizer",",","e.g.",",","GAN",")",".","work_dir","(","str",",","optional",")",":","The","working","directory","to","save","checkpoints","and","logs",".","Defaults","to","None",".","logger","(",":","obj",":","`","logging.Logger","`",")",":","Logger","used","during","training",".","Defaults","to","None",".","(","The","default","value","is","just","for","backward","compatibility",")","meta","(","dict","|","None",")",":","A","dict","records","some","import","information","such","as","environment","info","and","seed",",","which","will","be","logged","in","logger","hook",".","Defaults","to","None",".","max_epochs","(","int",",","optional",")",":","Total","training","epochs",".","max_iters","(","int",",","optional",")",":","Total","training","iterations","."]
docstr: Register a hook into the hook list.
  
  The hook will be inserted into a priority queue, with the specified
  priority (See :class:`Priority` for details of priorities).
  For hooks with the same priority, they will be triggered in the same
  order as they are registered.
  
  Args:
      hook (:obj:`Hook`): The hook to be registered.
      priority (int or str or :obj:`Priority`): Hook priority.
          Lower value means higher priority.
docstr_tok: ["Register","a","hook","into","the","hook","list",".","The","hook","will","be","inserted","into","a","priority","queue",",","with","the","specified","priority","(","See",":","class",":","`","Priority","`","for","details","of","priorities",")",".","For","hooks","with","the","same","priority",",","they","will","be","triggered","in","the","same","order","as","they","are","registered",".","Args",":","hook","(",":","obj",":","`","Hook","`",")",":","The","hook","to","be","registered",".","priority","(","int","or","str","or",":","obj",":","`","Priority","`",")",":","Hook","priority",".","Lower","value","means","higher","priority","."]
code: def register_hook(self, hook, priority="NORMAL"):
      """Register a hook into the hook list.
  
      The hook will be inserted into a priority queue, with the specified
      priority (See :class:`Priority` for details of priorities).
      For hooks with the same priority, they will be triggered in the same
      order as they are registered.
  
      Args:
          hook (:obj:`Hook`): The hook to be registered.
          priority (int or str or :obj:`Priority`): Hook priority.
              Lower value means higher priority.
      """
      assert isinstance(hook, Hook)
      if hasattr(hook, "priority"):
          raise ValueError(
              '"priority" is a reserved attribute for hooks'
          )
      priority = get_priority(priority)
      hook.priority = priority
      # insert the hook to a sorted list
      inserted = False
      for i in range(len(self._hooks) - 1, -1, -1):
          if priority >= self._hooks[i].priority:
              self._hooks.insert(i + 1, hook)
              inserted = True
              break
      if not inserted:
          self._hooks.insert(0, hook)
  
imports: import copy
  import logging
  import os.path
  import warnings
  from abc import ABCMeta, abstractmethod
  import torch
  from torch.optim import Optimizer
  import annotator.uniformer.mmcv
  from ..parallel import is_module_wrapper
  from .checkpoint import load_checkpoint
  from .dist_utils import get_dist_info
  from .hooks import HOOKS, Hook
  from .log_buffer import LogBuffer
  from .priority import Priority, get_priority
  from .utils import get_time_str
label_desc: Use image node_id 17 for calling the BaseRunner obj's underlying member method code with example usage: obj.register_hook(hook, priority) without return types