class_docstr: A callback which logs system stats, including:
  - CPU usage
  - resident set size
  - GPU usage
  - cuda memory stats
  
  Args:
      loggers: Either a :class:`torchtnt.loggers.logger.MetricLogger` or
          list of :class:`torchtnt.loggers.logger.MetricLogger`
      logging_interval: whether to print system state every step or every epoch. Defaults to every epoch.
class_docstr_tok: ["A","callback","which","logs","system","stats",",","including",":","-","CPU","usage","-","resident","set","size","-","GPU","usage","-","cuda","memory","stats","Args",":","loggers",":","Either","a",":","class",":","`","torchtnt.loggers.logger.MetricLogger","`","or","list","of",":","class",":","`","torchtnt.loggers.logger.MetricLogger","`","logging_interval",":","whether","to","print","system","state","every","step","or","every","epoch",".","Defaults","to","every","epoch","."]
code: def __init__(
      self,
      loggers: Union[MetricLogger, List[MetricLogger]],
      *,
      logging_interval: Literal["epoch", "step"] = "epoch",
  ) -> None:
      if not isinstance(loggers, list):
          loggers = [loggers]
  
      expected_intervals = ("epoch", "step")
      if logging_interval not in expected_intervals:
          raise ValueError(
              f"Invalid value '{logging_interval}' for argument logging_interval. Accepted values are {expected_intervals}."
          )
  
      self._loggers: List[MetricLogger] = loggers
      self.logging_interval = logging_interval
      self.process = psutil.Process()
      self.max_gpu_mem_usage_b: Optional[float] = None
      self.device: torch.device = get_device_from_env()
  
file_path: tnt/torchtnt/framework/callbacks/system_resources_monitor.py
imports: from typing import Dict, List, Optional, Union
  import psutil
  import torch
  from torchtnt.framework.callback import Callback
  from torchtnt.framework.state import State
  from torchtnt.framework.unit import TEvalUnit, TPredictUnit, TTrainUnit
  from torchtnt.utils.device import collect_system_stats, get_device_from_env
  from torchtnt.utils.loggers.logger import MetricLogger
label_desc: Use image node_id 1 to create a new SystemResourcesMonitor object from inherited base classes: Callback with example: obj = SystemResourcesMonitor(loggers)