class_docstr: Class used to track pytorch memory usage
  Arguments:
      detail(bool, default True): whether the function shows the detail gpu memory usage
      path(str): where to save log file
      verbose(bool, default False): whether show the trivial exception
      device(int): GPU number, default is 0
class_docstr_tok: ["Class","used","to","track","pytorch","memory","usage","Arguments",":","detail","(","bool",",","default","True",")",":","whether","the","function","shows","the","detail","gpu","memory","usage","path","(","str",")",":","where","to","save","log","file","verbose","(","bool",",","default","False",")",":","whether","show","the","trivial","exception","device","(","int",")",":","GPU","number",",","default","is","0"]
code: def __init__(
      self,
      detail=True,
      path="",
      verbose=False,
      device=0,
      log_to_disk=False,
  ):
      self.print_detail = detail
      self.last_tensor_sizes = set()
      self.gpu_profile_fn = (
          path
          + f"{datetime.datetime.now():%d-%b-%y-%H:%M:%S}-gpu_mem_track.txt"
      )
      self.verbose = verbose
      self.begin = True
      self.device = device
      self.log_to_disk = log_to_disk
  
file_path: h2ogpt/models/gpu_mem_track.py
imports: import gc
  import datetime
  import inspect
  import torch
  import numpy
  import contextlib, sys
label_desc: Use image node_id 1 to create a new MemTracker object from inherited base classes: object with example: obj = MemTracker(detail, path, verbose, device, log_to_disk)