code: def __init__(self, detail: bool):
      self.gpus = []
      self.processes = []
  
      try:
          self.gpu_number = nvmlDeviceGetCount()
      except Exception as e:
          errors.add(f"gpu_number: {e}")
  
      if detail:
          try:
              self.driver_version = nvmlSystemGetDriverVersion()
          except Exception as e:
              errors.add(f"driver_version: {e}")
  
          try:
              self.cuda_version = nvmlSystemGetCudaDriverVersion_v2()
          except Exception as e:
              errors.add(f"cuda_version: {e}")
  
      self.gpus = [
          GpuInfo(index, detail) for index in range(self.gpu_number)
      ]
  
      procs = []
      for gpu in self.gpus:
          procs += gpu._procs
      self.processes = sorted(procs, key=(lambda proc: proc.pid))
  
file_path: nni/nni/tools/nni_manager_scripts/collect_gpu_info.py
imports: from __future__ import annotations
  from dataclasses import asdict, dataclass
  import json
  import sys
  from typing import Any, Literal
  from pynvml import *
label_desc: Use image node_id 1 to create a new SystemInfo object  with example: obj = SystemInfo(detail)