code: def before_run(self, runner):
      super(PaviLoggerHook, self).before_run(runner)
      try:
          from pavi import SummaryWriter
      except ImportError:
          raise ImportError(
              'Please run "pip install pavi" to install pavi.'
          )
  
      self.run_name = runner.work_dir.split("/")[-1]
  
      if not self.init_kwargs:
          self.init_kwargs = dict()
      self.init_kwargs["name"] = self.run_name
      self.init_kwargs["model"] = runner._model_name
      if runner.meta is not None:
          if "config_dict" in runner.meta:
              config_dict = runner.meta["config_dict"]
              assert isinstance(config_dict, dict), (
                  'meta["config_dict"] has to be of a dict, '
                  f"but got {type(config_dict)}"
              )
          elif "config_file" in runner.meta:
              config_file = runner.meta["config_file"]
              config_dict = dict(mmcv.Config.fromfile(config_file))
          else:
              config_dict = None
          if config_dict is not None:
              # 'max_.*iter' is parsed in pavi sdk as the maximum iterations
              #  to properly set up the progress bar.
              config_dict = config_dict.copy()
              config_dict.setdefault("max_iter", runner.max_iters)
              # non-serializable values are first converted in
              # mmcv.dump to json
              config_dict = json.loads(
                  mmcv.dump(config_dict, file_format="json")
              )
              session_text = yaml.dump(config_dict)
              self.init_kwargs["session_text"] = session_text
      self.writer = SummaryWriter(**self.init_kwargs)
  
file_path: lavis/lavis/common/annotator/uniformer/mmcv/runner/hooks/logger/pavi.py
imports: import json
  import os
  import os.path
  import torch
  import yaml
  import annotator.uniformer.mmcv
  from ....parallel.utils import is_module_wrapper
  from ...dist_utils import master_only
  from ..hook import HOOKS
  from .base import LoggerHook
label_desc: Use image node_id 2 for calling the PaviLoggerHook obj's underlying member method code with example usage: obj.before_run(runner) without return types