class_docstr: Members:
      eval_only: If True, only run evaluation using the test dataloader.
      max_epochs: Train for this many epochs. Note that if the model was
          loaded from a checkpoint, we will restart training at the appropriate
          epoch and run for (max_epochs - checkpoint_epoch) epochs.
      store_checkpoints: If True, store model and optimizer state checkpoints.
      store_checkpoints_purge: If >= 0, remove any checkpoints older or equal
          to this many epochs.
      test_interval: Evaluate on a test dataloader each `test_interval` epochs.
      test_when_finished: If True, evaluate on a test dataloader when training
          completes.
      validation_interval: Validate each `validation_interval` epochs.
      clip_grad: Optionally clip the gradient norms.
          If set to a value <=0.0, no clipping
      metric_print_interval: The batch interval at which the stats should be
          logged.
      visualize_interval: The batch interval at which the visualizations
          should be plotted
      visdom_env: The name of the Visdom environment to use for plotting.
      visdom_port: The Visdom port.
      visdom_server: Address of the Visdom server.
docstr: Load Stats that correspond to the model's log_vars and resume_epoch.
  
  Args:
      log_vars: A list of variable names to log. Should be a subset of the
          `preds` returned by the forward function of the corresponding
          ImplicitronModelBase instance.
      exp_dir: Root experiment directory.
      resume: If False, do not load stats from the checkpoint speci-
          fied by resume and resume_epoch; instead, create a fresh stats object.
  
  stats: The stats structure (optionally loaded from checkpoint)
docstr_tok: ["Load","Stats","that","correspond","to","the","model","'s","log_vars","and","resume_epoch",".","Args",":","log_vars",":","A","list","of","variable","names","to","log",".","Should","be","a","subset","of","the","`","preds","`","returned","by","the","forward","function","of","the","corresponding","ImplicitronModelBase","instance",".","exp_dir",":","Root","experiment","directory",".","resume",":","If","False",",","do","not","load","stats","from","the","checkpoint","speci-","fied","by","resume","and","resume_epoch",";","instead",",","create","a","fresh","stats","object",".","stats",":","The","stats","structure","(","optionally","loaded","from","checkpoint",")"]
code: def load_stats(
      self,
      log_vars: List[str],
      exp_dir: str,
      resume: bool = True,
      resume_epoch: int = -1,
      **kwargs,
  ) -> Stats:
      """
      Load Stats that correspond to the model's log_vars and resume_epoch.
  
      Args:
          log_vars: A list of variable names to log. Should be a subset of the
              `preds` returned by the forward function of the corresponding
              ImplicitronModelBase instance.
          exp_dir: Root experiment directory.
          resume: If False, do not load stats from the checkpoint speci-
              fied by resume and resume_epoch; instead, create a fresh stats object.
  
      stats: The stats structure (optionally loaded from checkpoint)
      """
      # Init the stats struct
      visdom_env_charts = (
          vis_utils.get_visdom_env(self.visdom_env, exp_dir) + "_charts"
      )
      stats = Stats(
          # log_vars should be a list, but OmegaConf might load them as ListConfig
          list(log_vars),
          plot_file=os.path.join(exp_dir, "train_stats.pdf"),
          visdom_env=visdom_env_charts,
          visdom_server=self.visdom_server,
          visdom_port=self.visdom_port,
      )
  
      model_path = None
      if resume:
          if resume_epoch > 0:
              model_path = model_io.get_checkpoint(
                  exp_dir, resume_epoch
              )
              if not os.path.isfile(model_path):
                  raise FileNotFoundError(
                      f"Cannot find stats from epoch {resume_epoch}."
                  )
          else:
              model_path = model_io.find_last_checkpoint(exp_dir)
  
      if model_path is not None:
          stats_path = model_io.get_stats_path(model_path)
          stats_load = model_io.load_stats(stats_path)
  
          # Determine if stats should be reset
          if resume:
              if stats_load is None:
                  logger.warning(
                      "\n\n\n\nCORRUPT STATS -> clearing stats\n\n\n\n"
                  )
                  last_epoch = model_io.parse_epoch_from_model_path(
                      model_path
                  )
                  logger.info(f"Estimated resume epoch = {last_epoch}")
  
                  # Reset the stats struct
                  for _ in range(last_epoch + 1):
                      stats.new_epoch()
                  assert last_epoch == stats.epoch
              else:
                  logger.info(
                      f"Found previous stats in {stats_path} -> resuming."
                  )
                  stats = stats_load
  
              # Update stats properties incase it was reset on load
              stats.visdom_env = visdom_env_charts
              stats.visdom_server = self.visdom_server
              stats.visdom_port = self.visdom_port
              stats.plot_file = os.path.join(exp_dir, "train_stats.pdf")
              stats.synchronize_logged_vars(log_vars)
          else:
              logger.info("Clearing stats")
  
      return stats
  
imports: import logging
  import os
  import time
  from typing import Any, List, Optional
  import torch
  from accelerate import Accelerator
  from pytorch3d.implicitron.evaluation.evaluator import EvaluatorBase
  from pytorch3d.implicitron.models.base_model import ImplicitronModelBase
  from pytorch3d.implicitron.models.generic_model import EvaluationMode
  from pytorch3d.implicitron.tools import model_io, vis_utils
  from pytorch3d.implicitron.tools.config import registry, ReplaceableBase, run_auto_creation
  from pytorch3d.implicitron.tools.stats import Stats
  from torch.utils.data import DataLoader, Dataset
  from .utils import seed_all_random_engines
label_desc: Use image node_id 3 for calling the ImplicitronTrainingLoop obj's underlying member method code with example usage: obj.load_stats(log_vars, exp_dir, resume, resume_epoch) and returns: stats