class_docstr: Class for monitoring GPU stats.
code: def collect_metrics(self):
      # Get GPU metrics.
      for i, handle in enumerate(self.gpu_handles):
          memory = pynvml.nvmlDeviceGetMemoryInfo(handle)
          self._metrics[f"gpu_{i}_memory_usage_percentage"].append(
              round(memory.used / memory.total * 100, 1)
          )
          self._metrics[f"gpu_{i}_memory_usage_megabytes"].append(
              memory.used / 1e6
          )
  
          device_utilization = pynvml.nvmlDeviceGetUtilizationRates(
              handle
          )
          self._metrics[f"gpu_{i}_utilization_percentage"].append(
              device_utilization.gpu
          )
  
imports: import logging
  import sys
  from mlflow.system_metrics.metrics.base_metrics_monitor import BaseMetricsMonitor
label_desc: Use image node_id 2 for calling the GPUMonitor obj's underlying member method code with example usage: obj.collect_metrics() without return types